Changeset 1909

Show
Ignore:
Timestamp:
25/09/03 16:01:06 (5 years ago)
Author:
andy
Message:

Added isAttribute(), isReference(), isCollection() methods

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/intermine/src/java/org/intermine/metadata/FieldDescriptor.java

    r1230 r1909  
    114114     */ 
    115115    public abstract int relationType(); // attr (NOT_RELATION), ref (N_1, 1_1) or coll (1_N, M_N) 
     116 
     117    /** 
     118     * Is this FieldDescriptor an attribute? 
     119     * 
     120     * @return true if this FieldDescriptor describes an attribute 
     121     */ 
     122    public boolean isAttribute() { 
     123        return relationType() == NOT_RELATION; 
     124    } 
     125 
     126    /** 
     127     * Is this FieldDescriptor a reference? 
     128     * 
     129     * @return true if this FieldDescriptor describes an attribute 
     130     */ 
     131    public boolean isReference() { 
     132        return (relationType() == ONE_ONE_RELATION) || (relationType() == N_ONE_RELATION); 
     133    } 
     134 
     135    /** 
     136     * Is this FieldDescriptor a collection? 
     137     * 
     138     * @return true if this FieldDescriptor describes an attribute 
     139     */ 
     140    public boolean isCollection() { 
     141        return (relationType() == ONE_N_RELATION) || (relationType() == M_N_RELATION); 
     142    } 
     143 
     144 
    116145}