- All Superinterfaces:
ModelElement
- All Known Implementing Classes:
AttributeImpl
An attribute.
Each attribute corresponds to a database column.
- Author:
- harald
-
Method Summary
Modifier and TypeMethodDescriptionGets the name of the application specific type, if a Convertible type.Returns the @Bindable-annotation text.Gets the column name.
This is the model's column name.
According to theDataType, an attribute may be mapped to more than one database column.getColumnName(int columnIndex) Gets the database column name.
For datatype with only one column, this is usually the same as the model's column name.DataType<?>Gets the model's data type.DataType<?>Gets the effective type exposed to the backend.
If this is an application specific type, the inner type will be returned.Gets the entity this attribute belongs to.Gets the getter method name.DataType<?>Gets the inner datatype exposed to the backend if Convertible.Gets the inner type name.
This is either the generic inner type or the wrapped type of Convertible types.Gets the java type.
Returns the java type with optional generic info.Gets the suffix to be used in methodnames.Gets the options.Gets the associated relation.getScale()Gets the scale for numbers with a fraction part.Gets the setter method name.getSize()Gets the column width.booleanReturns whether the attribute's type implements a Convertible.booleanisHidden()Returns whether attribute is hidden and not part of the interface.booleanReturns whether attribute is implicit and not result of an attribute line configuration.booleanReturns whether database column is nullable.toMethodArgument(String value) Conberts a given value string to a valid java method argument.
Adds downcasts, if necessary.voidvalidate()Validates the attribute.Methods inherited from interface org.tentackle.model.ModelElement
getName, getOrdinal, getParent, getSourceInfo
-
Method Details
-
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 theDataType, an attribute may be mapped to more than one database column.- Returns:
- the column name (always in lowercase)
- See Also:
-
getColumnName
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 theDataType.- Returns:
- the column name used by the database
- Throws:
ModelException- if the effective datatype could not be determined- See Also:
-
getDataType
DataType<?> getDataType()Gets the model's data type.- Returns:
- the data type
-
getInnerTypeName
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
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
Gets the inner datatype exposed to the backend if Convertible.- Returns:
- the inner type for the backend
- Throws:
ModelException- if not a Convertible
-
getEffectiveDataType
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
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
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
-
validate
Validates the attribute.- Throws:
ModelException- if validation failed
-
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
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
-