- All Superinterfaces:
ModelElement
- All Known Implementing Classes:
AttributeImpl
An attribute.
Each attribute corresponds to a database column.
- Author:
- harald
-
Method Summary
Modifier and TypeMethodDescriptioncreateEmbedded(Entity embeddingEntity, String pathName, String columnName) Creates an embedded copy of this attribute.Gets 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(Backend backend, 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 embedding entity.
Please notice that the embedding entity is determined by the specific relation, andisEmbedded()just means that the attribute is part of an embeddable entity.Gets the path of embedding entities.
The first entity is non-embedded.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 pathname.
The pathname is identical to the java name for non-embedded entities.
For embedded entities, the pathname consists of the dotted path from the parent entity to the embedded attribute.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.booleanReturns whether the attribute belongs to an embedded entity.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) Converts a given value string to a valid java method argument.
Adds a downcast, 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- 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
-
createEmbedded
Creates an embedded copy of this attribute.- Parameters:
embeddingEntity- the embedding entitypathName- the logical pathnamecolumnName- the new column name- Returns:
- the created attribute
-
getEmbeddingEntity
Entity getEmbeddingEntity()Gets the embedding entity.
Please notice that the embedding entity is determined by the specific relation, andisEmbedded()just means that the attribute is part of an embeddable entity.- Returns:
- the embedding entity, null if not an embedded attribute
-
getEmbeddingPath
Gets the path of embedding entities.
The first entity is non-embedded.- Returns:
- the embedding path (never empty), null if attribute is not embedded
-
getPathName
String getPathName()Gets the pathname.
The pathname is identical to the java name for non-embedded entities.
For embedded entities, the pathname consists of the dotted path from the parent entity to the embedded attribute.- Returns:
- the pathname
-
isEmbedded
boolean isEmbedded()Returns whether the attribute belongs to an embedded entity.- Returns:
- true if embedded
-
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 garbled
-
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
Converts a given value string to a valid java method argument.
Adds a downcast, if necessary.- Parameters:
value- the value string- Returns:
- the method argument string
- Throws:
ModelException
-