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 Object
      • 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)
      • isConvertible

        public boolean isConvertible()
        Description copied from interface: Attribute
        Returns whether the attribute's type implements a Convertible.
        Specified by:
        isConvertible in interface Attribute
        Returns:
        true if Convertible
      • setApplicationTypeName

        public void setApplicationTypeName​(String applicationTypeName)
        Sets the application specific type if Convertible.
        Parameters:
        applicationTypeName - the name of the application specific type
      • getApplicationTypeName

        public String getApplicationTypeName()
                                      throws ModelException
        Description copied from interface: Attribute
        Gets the name of the application specific type, if a Convertible type.
        Specified by:
        getApplicationTypeName in interface Attribute
        Returns:
        the application specific type, never null or empty
        Throws:
        ModelException - if this is not a Convertible type
      • setInnerTypeName

        public void setInnerTypeName​(String innerTypeName)
                              throws ModelException
        Sets the inner type name.
        Parameters:
        innerTypeName - the name of the inner type
        Throws:
        ModelException - if datatype is Convertible and the inner type is not supported or inner type not applicable to datatype
      • getInnerTypeName

        public String getInnerTypeName()
                                throws ModelException
        Description copied from interface: Attribute
        Gets the inner type name.
        This is either the generic inner type or the wrapped type of Convertible types.
        Specified by:
        getInnerTypeName in interface Attribute
        Returns:
        the inner type name
        Throws:
        ModelException - if not an application type or innername not set
      • getEffectiveDataType

        public DataType<?> getEffectiveDataType()
                                         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:
        getEffectiveDataType in interface Attribute
        Returns:
        the effective data type
        Throws:
        ModelException - if model garbeled
      • getJavaType

        public String getJavaType()
                           throws ModelException
        Description copied from interface: Attribute
        Gets the java type.
        Returns the java type with optional generic info.

        Examples:

         Date
         Binary<Invoice>
         MyType;
         
        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
      • getDataType

        public DataType<?> getDataType()
        Description copied from interface: Attribute
        Gets the model's data type.
        Specified by:
        getDataType in interface Attribute
        Returns:
        the data type
      • getSize

        public 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
      • getScale

        public 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
      • setColumnName

        public void setColumnName​(String columnName)
      • setDataType

        public void setDataType​(DataType<?> dataType)
      • setRelation

        public void setRelation​(Relation relation)
      • setName

        public void setName​(String javaName)
      • setScale

        public void setScale​(Integer scale)
      • setSize

        public void setSize​(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​(Boolean nullable)
        Overrides nullable feature.
        Parameters:
        nullable - null to determine from datatype
      • 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​(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 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 String getGetterName()
        Description copied from interface: Attribute
        Gets the getter method name.
        Specified by:
        getGetterName in interface Attribute
        Returns:
        the getter
      • getSetterName

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

        public 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 String toMethodArgument​(String value)
                                throws ModelException
        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
        Throws:
        ModelException