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.- Author:
- Richard Smith
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
fairTerm
protected java.lang.String
type
static java.util.Set<java.lang.String>
VALID_TYPES
This 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 boolean
equals(java.lang.Object obj)
java.lang.String
getFairTerm()
Get the term for the attribute - a URI pointing to an ontology term describing this attribute.java.lang.String
getType()
Get the type of the attribute - either name of primitive or fully qualified class name.int
hashCode()
boolean
isNumeric()
Returns true if the type of the attribute is some kind of number.boolean
isPrimitive()
Returns true if the type of the attribute is a primitive type (rather than object).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".java.lang.String
toJSONString()
Return the JSON representation of this object.java.lang.String
toString()
-
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:
relationType
in classFieldDescriptor
- Returns:
- int to describe the relationship type
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toJSONString
public java.lang.String toJSONString()
Return the JSON representation of this object.- Specified by:
toJSONString
in 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.
-
-