Package org.intermine.metadata
Class FieldDescriptor
- java.lang.Object
-
- org.intermine.metadata.FieldDescriptor
-
- Direct Known Subclasses:
AttributeDescriptor,ReferenceDescriptor
public abstract class FieldDescriptor extends java.lang.ObjectAbstract representation of a field within a class - could be an attribute, an object reference or a collection.
-
-
Field Summary
Fields Modifier and Type Field Description protected ClassDescriptorcldstatic intM_N_RELATIONA M:N relationship.static intN_ONE_RELATIONA N:1 relationship.protected java.lang.Stringnamestatic intNOT_RELATIONNot a relationship between objectsstatic intONE_N_RELATIONA 1:N relationship.static intONE_ONE_RELATIONA 1:1 relationship
-
Constructor Summary
Constructors Constructor Description FieldDescriptor(java.lang.String name)Construct, name of field must not be null and must be a valid Java variable name.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ClassDescriptorgetClassDescriptor()Get the ClassDescriptor for this field's class.java.lang.StringgetName()Get the name of the described field.booleanisAttribute()Is this FieldDescriptor an attribute?booleanisCollection()Is this FieldDescriptor a collection?booleanisReference()Is this FieldDescriptor a reference?abstract 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".protected voidsetClassDescriptor(ClassDescriptor cld)Set the parent ClassDescriptor - should be called when this is added to a ClassDescriptor.abstract java.lang.StringtoJSONString()Return the JSON representation of this object.
-
-
-
Field Detail
-
NOT_RELATION
public static final int NOT_RELATION
Not a relationship between objects- See Also:
- Constant Field Values
-
ONE_ONE_RELATION
public static final int ONE_ONE_RELATION
A 1:1 relationship- See Also:
- Constant Field Values
-
ONE_N_RELATION
public static final int ONE_N_RELATION
A 1:N relationship.- See Also:
- Constant Field Values
-
N_ONE_RELATION
public static final int N_ONE_RELATION
A N:1 relationship.- See Also:
- Constant Field Values
-
M_N_RELATION
public static final int M_N_RELATION
A M:N relationship.- See Also:
- Constant Field Values
-
name
protected final java.lang.String name
-
cld
protected ClassDescriptor cld
-
-
Method Detail
-
getClassDescriptor
public ClassDescriptor getClassDescriptor()
Get the ClassDescriptor for this field's class.- Returns:
- a the ClassDescriptor for this field's class
-
getName
public java.lang.String getName()
Get the name of the described field.- Returns:
- name of the field
-
setClassDescriptor
protected void setClassDescriptor(ClassDescriptor cld)
Set the parent ClassDescriptor - should be called when this is added to a ClassDescriptor. ClassDescriptor in this class is final so a MetadataException is thrown if method called again.- Parameters:
cld- the parent ClassDescriptor- Throws:
java.lang.IllegalStateException- if the parent ClassDescriptor is not set
-
relationType
public abstract 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".- Returns:
- int to describe the relationship type
-
isAttribute
public boolean isAttribute()
Is this FieldDescriptor an attribute?- Returns:
- true if this FieldDescriptor describes an attribute
-
isReference
public boolean isReference()
Is this FieldDescriptor a reference?- Returns:
- true if this FieldDescriptor describes a reference
-
isCollection
public boolean isCollection()
Is this FieldDescriptor a collection?- Returns:
- true if this FieldDescriptor describes a collection
-
toJSONString
public abstract java.lang.String toJSONString()
Return the JSON representation of this object.- Returns:
- a string containing JSON
-
-