public class AttributeImpl extends Object implements Attribute, Comparable<AttributeImpl>
| Constructor and Description |
|---|
AttributeImpl(EntityFactoryImpl factory,
Entity entity,
SourceInfo sourceInfo,
boolean implicit)
Creates an attribute.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(AttributeImpl o) |
ModelException |
createModelException(String message)
Creates a model exception.
|
boolean |
equals(Object obj) |
String |
getApplicationType()
Gets the application specific type.
|
String |
getBindableAnnotation()
Returns the @Bindable-annotation text.
|
String |
getColumnName()
Gets the database column name.
|
DataType |
getDataType()
Gets the data type.
|
Entity |
getEntity()
Gets the entity this attribute belongs to.
|
String |
getGetterName()
Gets the getter method name.
|
String |
getInnerName()
Returns the inner type.
|
DataType |
getInnerType()
Gets the innertype for application specific types.
|
String |
getJavaName()
Gets the Java-Name of the attribute.
|
String |
getJavaType()
Gets the java type.
Returns the java type with optional generic info. |
String |
getMethodNameSuffix()
Gets the suffix to be used in methodnames.
|
AttributeOptionsImpl |
getOptions()
Gets the options.
|
Relation |
getRelation()
Gets the associated relation.
|
Integer |
getScale()
Gets the scale for numbers with a fraction part.
|
int |
getScaleWithDefault()
Gets the scale width with default 0.
|
String |
getSetterName()
Gets the setter method name.
|
Integer |
getSize()
Gets the column width.
|
int |
getSizeWithDefault()
Gets the column width with default 0.
|
AttributeLine |
getSourceLine()
Gets the source line.
|
int |
hashCode() |
boolean |
isImplicit()
Returns whether attribute is implicit and not result of an attribute line configuration.
|
boolean |
isNullable()
Returns whether database column is nullable.
|
void |
parse(Entity entity,
AttributeLine line)
Parses an attribute line.
|
void |
setApplicationType(String applicationType)
Sets the application specific type.
Only allowed DataType.APPLICATION. |
void |
setColumnName(String columnName) |
void |
setDataType(DataType dataType) |
void |
setInnerName(String innerType)
Sets the inner type.
|
void |
setJavaName(String javaName) |
void |
setNullable(Boolean nullable)
Overrides nullable feature.
|
void |
setRelation(Relation relation) |
void |
setScale(Integer scale) |
void |
setSize(Integer size) |
void |
setSourceLine(AttributeLine sourceLine) |
String |
toString() |
void |
validate()
Validates the attribute.
|
public AttributeImpl(EntityFactoryImpl factory, Entity entity, SourceInfo sourceInfo, boolean implicit)
factory - the factory to create the attribute optionsentity - the entity this attribute belongs tosourceInfo - the source infoimplicit - true if implicit attributepublic int compareTo(AttributeImpl o)
compareTo in interface Comparable<AttributeImpl>public boolean isImplicit()
AttributeisImplicit in interface Attributepublic Entity getEntity()
Attributepublic void parse(Entity entity, AttributeLine line) throws ModelException
entity - the entityline - the source lineModelException - if parsing the model failedpublic void setApplicationType(String applicationType) throws ModelException
DataType.APPLICATION.applicationType - the application specific typeModelException - if this is not DataType.APPLICATIONpublic String getApplicationType() throws ModelException
getApplicationType in interface AttributeModelException - if application specific type not set or this is not DataType.APPLICATIONpublic void setInnerName(String innerType) throws ModelException
innerType - the inner typeModelException - if this is neither DataType.APPLICATION nor DataType.BINARYpublic String getInnerName() throws ModelException
getInnerName in interface AttributeDataType.BINARY)ModelException - this is DataType.APPLICATION and inner type not setpublic DataType getInnerType() throws ModelException
getInnerType in interface AttributeModelException - if not DataType.APPLICATION or innertype not a legal DataType.public String getJavaType() throws ModelException
Examples:
Date Binary<Invoice> MyType<int>
getJavaType in interface AttributeModelException - if type is misconfiguredpublic Relation getRelation()
AttributegetRelation in interface Attributepublic String getJavaName()
AttributegetJavaName in interface Attributepublic String getColumnName()
AttributegetColumnName in interface Attributepublic DataType getDataType()
AttributegetDataType in interface Attributepublic Integer getSize()
AttributeFor strings this is the maximum number of characters. For numerics this is only a hint for the GUI.
public int getSizeWithDefault()
AttributegetSizeWithDefault in interface Attributepublic Integer getScale()
Attributepublic int getScaleWithDefault()
AttributegetScaleWithDefault in interface Attributepublic AttributeOptionsImpl getOptions()
AttributegetOptions in interface Attributepublic void setColumnName(String columnName)
public void setDataType(DataType dataType)
public void setRelation(Relation relation)
public void setJavaName(String javaName)
public void setScale(Integer scale)
public void setSize(Integer size)
public boolean isNullable()
throws ModelException
AttributeisNullable in interface AttributeModelException - if type is misconfiguredpublic void setNullable(Boolean nullable)
nullable - null to determine from datatypepublic void validate()
throws ModelException
Attributevalidate in interface AttributeModelException - if validation failedpublic AttributeLine getSourceLine()
AttributegetSourceLine in interface Attributepublic void setSourceLine(AttributeLine sourceLine)
public ModelException createModelException(String message)
Refers to the source line if set, otherwise just the message.
message - the messagepublic String getMethodNameSuffix()
AttributeExample:
"set" + getMethodNameSuffix() would return "setBlah" if the javaName is "blah".
getMethodNameSuffix in interface Attributepublic String getGetterName()
AttributegetGetterName in interface Attributepublic String getSetterName()
AttributegetSetterName in interface Attributepublic String getBindableAnnotation()
AttributegetBindableAnnotation in interface AttributeCopyright © 2016 Krake Softwaretechnik. All rights reserved.