Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java51
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IAttributeType.java5
2 files changed, 52 insertions, 4 deletions
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java
new file mode 100644
index 00000000000..f043f9bc078
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.data;
+
+import org.codehaus.jackson.annotate.JsonCreator;
+import org.eclipse.osee.framework.jdk.core.type.FullyNamed;
+import org.eclipse.osee.framework.jdk.core.type.HasDescription;
+import org.eclipse.osee.framework.jdk.core.type.Id;
+import org.eclipse.osee.framework.jdk.core.type.Named;
+import org.eclipse.osee.framework.jdk.core.type.NamedId;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public interface AttributeTypeToken extends AttributeTypeId, FullyNamed, HasDescription {
+ AttributeTypeToken SENTINEL = valueOf(Id.SENTINEL, Named.SENTINEL);
+
+ public static AttributeTypeToken valueOf(String id) {
+ return valueOf(Long.valueOf(id), Named.SENTINEL);
+ }
+
+ public static AttributeTypeToken valueOf(long id, String name) {
+ return valueOf(id, name, "");
+ }
+
+ @JsonCreator
+ public static AttributeTypeToken valueOf(long id, String name, String description) {
+ final class AttributeTypeImpl extends NamedId implements AttributeTypeToken {
+ private final String description;
+
+ public AttributeTypeImpl(Long txId, String name, String description) {
+ super(txId, name);
+ this.description = description;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+ }
+ return new AttributeTypeImpl(id, name, description);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IAttributeType.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IAttributeType.java
index 62aab2bf8a0..68eab5dc2f5 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IAttributeType.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IAttributeType.java
@@ -11,9 +11,6 @@
package org.eclipse.osee.framework.core.data;
import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.eclipse.osee.framework.jdk.core.type.FullyNamed;
-import org.eclipse.osee.framework.jdk.core.type.HasDescription;
-import org.eclipse.osee.framework.jdk.core.type.Id;
import org.eclipse.osee.framework.jdk.core.type.IdSerializer;
import org.eclipse.osee.framework.jdk.core.type.Identifiable;
@@ -21,7 +18,7 @@ import org.eclipse.osee.framework.jdk.core.type.Identifiable;
* @author Ryan D. Brooks
*/
@JsonSerialize(using = IdSerializer.class)
-public interface IAttributeType extends Identifiable<Long>, FullyNamed, HasDescription, Id {
+public interface IAttributeType extends Identifiable<Long>, AttributeTypeToken {
@Override
default Long getId() {

Back to the top