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

        java.lang.String getColumnName()
        Gets the database column name.
        Returns:
        the column name (always in lowercase)
      • getDataType

        DataType getDataType()
        Gets the data type.
        Returns:
        the java data type
      • getInnerName

        java.lang.String getInnerName()
                               throws ModelException
        Gets the inner name.
        This is either the generic inner type or the wrapped type used by application specific types, for example enums.
        Returns:
        the wrapping type, null if not wrapped
        Throws:
        ModelException - if not an application type or innername not set
      • getSize

        java.lang.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
      • getSizeWithDefault

        int getSizeWithDefault()
        Gets the column width with default 0.
        Returns:
        the column width or 0 if not set
      • getScale

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

        int getScaleWithDefault()
        Gets the scale width with default 0.
        Returns:
        the scale or 0 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
      • getApplicationType

        java.lang.String getApplicationType()
                                     throws ModelException
        Gets the application specific type.
        Returns:
        the application specific type, never null or empty
        Throws:
        ModelException - if application specific type not set or this is not DataType.APPLICATION
      • getInnerType

        DataType getInnerType()
                       throws ModelException
        Gets the innertype for application specific types.
        Returns:
        the inner type to convert to agains the backend
        Throws:
        ModelException - if not application specific type or innertype not a legal DataType.
      • getEffectiveType

        DataType getEffectiveType()
                           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

        java.lang.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

        java.lang.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

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

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

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

        java.lang.String toMethodArgument​(java.lang.String value)
        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