Interface Attribute

  • All Superinterfaces:
    ModelElement
    All Known Implementing Classes:
    AttributeImpl

    public interface Attribute
    extends ModelElement
    An attribute.

    Each attribute corresponds to a database column.

    Author:
    harald
    • Method Detail

      • getEntity

        Entity getEntity()
        Gets the entity this attribute belongs to.
        Returns:
        the entity
      • getColumnName

        String getColumnName()
        Gets the column name.
        This is the model's column name.
        According to the DataType, an attribute may be mapped to more than one database column.
        Returns:
        the column name (always in lowercase)
        See Also:
        getColumnName(int), getDataType()
      • getColumnName

        String getColumnName​(int columnIndex)
                      throws ModelException
        Gets the database column name.
        For datatype with only one column, this is usually the same as the model's column name.
        Parameters:
        columnIndex - the column index according to the DataType.
        Returns:
        the column name used by the database
        Throws:
        ModelException - if the effective datatype could not be determined
        See Also:
        getColumnName(), getDataType()
      • getDataType

        DataType<?> getDataType()
        Gets the model's data type.
        Returns:
        the data type
      • getInnerTypeName

        String getInnerTypeName()
                         throws ModelException
        Gets the inner type name.
        This is either the generic inner type or the wrapped type of Convertible types.
        Returns:
        the inner type name
        Throws:
        ModelException - if not an application type or innername not set
      • getSize

        Integer getSize()
        Gets the column width.

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

        Returns:
        the size, null if not set
      • getScale

        Integer getScale()
        Gets the scale for numbers with a fraction part.
        Returns:
        the scale, null if not set
      • getOptions

        AttributeOptions getOptions()
        Gets the options.
        Returns:
        the options
      • isImplicit

        boolean isImplicit()
        Returns whether attribute is implicit and not result of an attribute line configuration.
        Returns:
        true if implicit
      • isHidden

        boolean isHidden()
        Returns whether attribute is hidden and not part of the interface.
        Returns:
        true if hidden
      • isConvertible

        boolean isConvertible()
        Returns whether the attribute's type implements a Convertible.
        Returns:
        true if Convertible
      • getApplicationTypeName

        String getApplicationTypeName()
                               throws ModelException
        Gets the name of the application specific type, if a Convertible type.
        Returns:
        the application specific type, never null or empty
        Throws:
        ModelException - if this is not a Convertible type
      • getInnerDataType

        DataType<?> getInnerDataType()
                              throws ModelException
        Gets the inner datatype exposed to the backend if Convertible.
        Returns:
        the inner type for the backend
        Throws:
        ModelException - if not a Convertible
      • getEffectiveDataType

        DataType<?> getEffectiveDataType()
                                  throws ModelException
        Gets the effective type exposed to the backend.
        If this is an application specific type, the inner type will be returned.
        Returns:
        the effective data type
        Throws:
        ModelException - if model garbeled
      • getJavaType

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

        Examples:

         Date
         Binary<Invoice>
         MyType;
         
        Returns:
        the type string
        Throws:
        ModelException - if type is misconfigured
      • isNullable

        boolean isNullable()
                    throws ModelException
        Returns whether database column is nullable.
        Returns:
        true if WITH NULL, false if NOT NULL
        Throws:
        ModelException - if type is misconfigured
      • getRelation

        Relation getRelation()
        Gets the associated relation.
        Returns:
        the relation, null if none
      • getMethodNameSuffix

        String getMethodNameSuffix()
        Gets the suffix to be used in methodnames.

        Example:

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

        String getGetterName()
        Gets the getter method name.
        Returns:
        the getter
      • getSetterName

        String getSetterName()
        Gets the setter method name.
        Returns:
        the setter
      • getBindableAnnotation

        String getBindableAnnotation()
        Returns the @Bindable-annotation text.
        Returns:
        the annotation text, null if none
      • toMethodArgument

        String toMethodArgument​(String value)
                         throws ModelException
        Conberts a given value string to a valid java method argument.
        Adds downcasts, if necessary.
        Parameters:
        value - the value string
        Returns:
        the method argument string
        Throws:
        ModelException