Interface Attribute
- 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 method names.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 the attribute is hidden and not part of the interface.booleanReturns whether the attribute is implicit and not result of an attribute line configuration.booleanReturns whether the 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 ModelElement
getModel, getName, getOrdinal, getParent, getSourceInfo
-
Method Details
-
getEntity
-
getColumnName
-
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
-
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 of an application type or inner name is 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
-
isImplicit
boolean isImplicit()Returns whether the attribute is implicit and not result of an attribute line configuration.- Returns:
- true if implicit
-
isHidden
boolean isHidden()Returns whether the 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
-
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
-
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 the type is misconfigured
-
isNullable
Returns whether the database column is nullable.- Returns:
- true if WITH NULL, false if NOT NULL
- Throws:
ModelException- if the type is misconfigured
-
getRelation
-
validate
Validates the attribute.- Throws:
ModelException- if validation failed
-
getMethodNameSuffix
String getMethodNameSuffix()Gets the suffix to be used in method names.Example:
"set" + getMethodNameSuffix() would return "setBlah" if the javaName is "blah".
- Returns:
- the suffix
-
getGetterName
-
getSetterName
-
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
-