Class AttributeImpl

    • Constructor Detail

      • AttributeImpl

        public AttributeImpl​(EntityFactoryImpl factory,
                             Entity entity,
                             SourceInfo sourceInfo,
                             boolean implicit)
        Creates an attribute.
        Parameters:
        factory - the factory to create the attribute options
        entity - the entity this attribute belongs to
        sourceInfo - the source info
        implicit - true if implicit attribute
    • Method Detail

      • getSourceInfo

        public SourceInfo getSourceInfo()
        Description copied from interface: ModelElement
        Gets the information about the source where this element is defined.
        Specified by:
        getSourceInfo in interface ModelElement
        Returns:
        the source info
      • hashCode

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

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

        public int compareTo​(AttributeImpl o)
        Specified by:
        compareTo in interface java.lang.Comparable<AttributeImpl>
      • isImplicit

        public boolean isImplicit()
        Description copied from interface: Attribute
        Returns whether attribute is implicit and not result of an attribute line configuration.
        Specified by:
        isImplicit in interface Attribute
        Returns:
        true if implicit
      • isHidden

        public boolean isHidden()
        Description copied from interface: Attribute
        Returns whether attribute is hidden and not part of the interface.
        Specified by:
        isHidden in interface Attribute
        Returns:
        true if hidden
      • getEntity

        public Entity getEntity()
        Description copied from interface: Attribute
        Gets the entity this attribute belongs to.
        Specified by:
        getEntity in interface Attribute
        Returns:
        the entity
      • getOrdinal

        public int getOrdinal()
        Description copied from interface: ModelElement
        Gets the ordinal along the inheritance path.
        Specified by:
        getOrdinal in interface ModelElement
        Returns:
        the ordinal, starting at 0
      • setOrdinal

        public void setOrdinal​(int ordinal)
      • getEffectiveType

        public DataType getEffectiveType()
                                  throws ModelException
        Description copied from interface: Attribute
        Gets the effective type exposed to the backend.
        If this is an application specific type, the inner type will be returned.
        Specified by:
        getEffectiveType in interface Attribute
        Returns:
        the effective data type
        Throws:
        ModelException - if model garbeled
      • getJavaType

        public java.lang.String getJavaType()
                                     throws ModelException
        Gets the java type.
        Returns the java type with optional generic info.

        Examples:

          Date
          Binary<Invoice>
          MyType<int>
         
        Specified by:
        getJavaType in interface Attribute
        Returns:
        the type string
        Throws:
        ModelException - if type is misconfigured
      • getRelation

        public Relation getRelation()
        Description copied from interface: Attribute
        Gets the associated relation.
        Specified by:
        getRelation in interface Attribute
        Returns:
        the relation, null if none
      • getName

        public java.lang.String getName()
        Description copied from interface: ModelElement
        Gets the name of the element.
        Specified by:
        getName in interface ModelElement
        Returns:
        the name
      • getColumnName

        public java.lang.String getColumnName()
        Description copied from interface: Attribute
        Gets the database column name.
        Specified by:
        getColumnName in interface Attribute
        Returns:
        the column name (always in lowercase)
      • getDataType

        public DataType getDataType()
        Description copied from interface: Attribute
        Gets the data type.
        Specified by:
        getDataType in interface Attribute
        Returns:
        the java data type
      • getSize

        public java.lang.Integer getSize()
        Description copied from interface: Attribute
        Gets the column width.

        For strings this is the maximum number of characters. For numerics this is only a hint for the GUI.

        Specified by:
        getSize in interface Attribute
        Returns:
        the size, null if not set
      • getSizeWithDefault

        public int getSizeWithDefault()
        Description copied from interface: Attribute
        Gets the column width with default 0.
        Specified by:
        getSizeWithDefault in interface Attribute
        Returns:
        the column width or 0 if not set
      • getScale

        public java.lang.Integer getScale()
        Description copied from interface: Attribute
        Gets the scale for numbers with a fraction part.
        Specified by:
        getScale in interface Attribute
        Returns:
        the scale, null if not set
      • getScaleWithDefault

        public int getScaleWithDefault()
        Description copied from interface: Attribute
        Gets the scale width with default 0.
        Specified by:
        getScaleWithDefault in interface Attribute
        Returns:
        the scale or 0 if not set
      • setColumnName

        public void setColumnName​(java.lang.String columnName)
      • setDataType

        public void setDataType​(DataType dataType)
      • setRelation

        public void setRelation​(Relation relation)
      • setName

        public void setName​(java.lang.String javaName)
      • setScale

        public void setScale​(java.lang.Integer scale)
      • setSize

        public void setSize​(java.lang.Integer size)
      • isNullable

        public boolean isNullable()
                           throws ModelException
        Description copied from interface: Attribute
        Returns whether database column is nullable.
        Specified by:
        isNullable in interface Attribute
        Returns:
        true if WITH NULL, false if NOT NULL
        Throws:
        ModelException - if type is misconfigured
      • setNullable

        public void setNullable​(java.lang.Boolean nullable)
        Overrides nullable feature.
        Parameters:
        nullable - null to determine from datatype
      • toString

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

        public AttributeLine getSourceLine()
        Gets the source line.
        Returns:
        the line
      • setSourceLine

        public void setSourceLine​(AttributeLine sourceLine)
        Sets the source line.
        Parameters:
        sourceLine - the line
      • createModelException

        public ModelException createModelException​(java.lang.String message)
        Creates a model exception.

        Refers to the source line if set, otherwise just the message.

        Parameters:
        message - the message
        Returns:
        the exception
      • getMethodNameSuffix

        public java.lang.String getMethodNameSuffix()
        Description copied from interface: Attribute
        Gets the suffix to be used in methodnames.

        Example:

         "set" + getMethodNameSuffix() would return "setBlah" if the javaName is "blah".
         
        Specified by:
        getMethodNameSuffix in interface Attribute
        Returns:
        the suffix
      • getGetterName

        public java.lang.String getGetterName()
        Description copied from interface: Attribute
        Gets the getter method name.
        Specified by:
        getGetterName in interface Attribute
        Returns:
        the getter
      • getSetterName

        public java.lang.String getSetterName()
        Description copied from interface: Attribute
        Gets the setter method name.
        Specified by:
        getSetterName in interface Attribute
        Returns:
        the setter
      • getBindableAnnotation

        public java.lang.String getBindableAnnotation()
        Description copied from interface: Attribute
        Returns the @Bindable-annotation text.
        Specified by:
        getBindableAnnotation in interface Attribute
        Returns:
        the annotation text, null if none
      • toMethodArgument

        public java.lang.String toMethodArgument​(java.lang.String value)
        Description copied from interface: Attribute
        Conberts a given value string to a valid java method argument.
        Adds downcasts, if necessary.
        Specified by:
        toMethodArgument in interface Attribute
        Parameters:
        value - the value string
        Returns:
        the method argument string