Class 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 Detail

      • type

        protected final java.lang.String type
      • fairTerm

        protected final java.lang.String fairTerm
      • VALID_TYPES

        public static final java.util.Set<java.lang.String> VALID_TYPES
        This is a list of the valid type strings.
    • 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 class
        type - name of primitive or a fully qualified class name
        fairTerm - 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 class FieldDescriptor
        Returns:
        int to describe the relationship type
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toJSONString

        public java.lang.String toJSONString()
        Return the JSON representation of this object.
        Specified by:
        toJSONString in class FieldDescriptor
        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.