Package org.intermine.metadata
Class AttributeDescriptor
- java.lang.Object
-
- org.intermine.metadata.FieldDescriptor
-
- org.intermine.metadata.AttributeDescriptor
-
public class AttributeDescriptor extends FieldDescriptor
Describes an attribute of a class - i.e. a field that is neither an object reference or a collection.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringfairTermprotected java.lang.Stringtypestatic java.util.Set<java.lang.String>VALID_TYPESThis is a list of the valid type strings.-
Fields inherited from class org.intermine.metadata.FieldDescriptor
cld, M_N_RELATION, N_ONE_RELATION, name, NOT_RELATION, ONE_N_RELATION, ONE_ONE_RELATION
-
-
Constructor Summary
Constructors Constructor Description AttributeDescriptor(java.lang.String name, java.lang.String type, java.lang.String fairTerm)Construct, name and type cannot be null.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)java.lang.StringgetFairTerm()Get the term for the attribute - a URI pointing to an ontology term describing this attribute.java.lang.StringgetType()Get the type of the attribute - either name of primitive or fully qualified class name.inthashCode()booleanisNumeric()Returns true if the type of the attribute is some kind of number.booleanisPrimitive()Returns true if the type of the attribute is a primitive type (rather than object).intrelationType()Return an integer describing the type of relationship this field represents, where relationship types are 1:1, 1:N, N:1, M:N and "not a relationship".java.lang.StringtoJSONString()Return the JSON representation of this object.java.lang.StringtoString()-
Methods inherited from class org.intermine.metadata.FieldDescriptor
getClassDescriptor, getName, isAttribute, isCollection, isReference, setClassDescriptor
-
-
-
-
Constructor Detail
-
AttributeDescriptor
public AttributeDescriptor(java.lang.String name, java.lang.String type, java.lang.String fairTerm)Construct, name and type cannot be null.- Parameters:
name- name of field in the classtype- name of primitive or a fully qualified class namefairTerm- URI pointing to an ontology term describing this attribute. can be null.- Throws:
java.lang.IllegalArgumentException- if arguments are null
-
-
Method Detail
-
getType
public java.lang.String getType()
Get the type of the attribute - either name of primitive or fully qualified class name.- Returns:
- type of attribute
-
getFairTerm
public java.lang.String getFairTerm()
Get the term for the attribute - a URI pointing to an ontology term describing this attribute. Can be null.- Returns:
- term describing this attribute
-
relationType
public int relationType()
Return an integer describing the type of relationship this field represents, where relationship types are 1:1, 1:N, N:1, M:N and "not a relationship".- Specified by:
relationTypein classFieldDescriptor- Returns:
- int to describe the relationship type
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toJSONString
public java.lang.String toJSONString()
Return the JSON representation of this object.- Specified by:
toJSONStringin classFieldDescriptor- Returns:
- a string containing JSON
-
isPrimitive
public boolean isPrimitive()
Returns true if the type of the attribute is a primitive type (rather than object).- Returns:
- true or false
-
isNumeric
public boolean isNumeric()
Returns true if the type of the attribute is some kind of number.- Returns:
- true or false.
-
-