-
- 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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringgetApplicationType()Gets the application specific type.java.lang.StringgetBindableAnnotation()Returns the @Bindable-annotation text.java.lang.StringgetColumnName()Gets the database column name.DataTypegetDataType()Gets the data type.DataTypegetEffectiveType()Gets the effective type exposed to the backend.
If this is an application specific type, the inner type will be returned.EntitygetEntity()Gets the entity this attribute belongs to.java.lang.StringgetGetterName()Gets the getter method name.java.lang.StringgetInnerName()Gets the inner name.
This is either the generic inner type or the wrapped type used by application specific types, for example enums.DataTypegetInnerType()Gets the innertype for application specific types.java.lang.StringgetJavaType()Gets the java type.
Returns the java type with optional generic info.java.lang.StringgetMethodNameSuffix()Gets the suffix to be used in methodnames.AttributeOptionsgetOptions()Gets the options.RelationgetRelation()Gets the associated relation.java.lang.IntegergetScale()Gets the scale for numbers with a fraction part.intgetScaleWithDefault()Gets the scale width with default 0.java.lang.StringgetSetterName()Gets the setter method name.java.lang.IntegergetSize()Gets the column width.intgetSizeWithDefault()Gets the column width with default 0.booleanisHidden()Returns whether attribute is hidden and not part of the interface.booleanisImplicit()Returns whether attribute is implicit and not result of an attribute line configuration.booleanisNullable()Returns whether database column is nullable.java.lang.StringtoMethodArgument(java.lang.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 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 ModelExceptionGets 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 ModelExceptionGets the application specific type.- Returns:
- the application specific type, never null or empty
- Throws:
ModelException- if application specific type not set or this is notDataType.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 ModelExceptionGets 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 ModelExceptionReturns 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
void validate() throws ModelExceptionValidates the attribute.- Throws:
ModelException- if validation failed
-
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
-
-