@Service(value=CodeFactory.class) public class CodeFactory extends Object
| Constructor and Description |
|---|
CodeFactory() |
| Modifier and Type | Method and Description |
|---|---|
String |
createBindableAnnotation(Attribute attribute)
Creates source code for the @Bindable-annotation.
|
String |
createColumnPostfix(String javaType,
int index)
Creates the column postfix for a given index.
For datatypes mapping to more than one column, the column names get a postfix. |
String |
createDeclaredJavaType(Relation relation,
boolean withinForeignEntity)
Creates the declared type of a relation.
|
String |
createGetterName(Attribute attribute)
Creates the name of the getter for an attribute.
|
String |
createGetterName(Relation relation)
Creates the name of the getter for a relation.
|
String |
createJavaType(Relation relation)
Creates the java type of a relation.
|
String |
createMethodArgument(Attribute attribute,
String value)
Creates the source code for a method argument.
|
String |
createSetterName(Attribute attribute)
Creates the name of the setter for an attribute.
|
String |
createSetterName(Relation relation)
Creates the name of the setter for a relation.
|
String |
createSqlForeignKey(ForeignKey foreignKey,
Backend backend)
Creates the foreign key creation sql code.
|
String |
createSqlIndex(Backend backend,
Entity entity,
Index index)
Creates the SQL code to create an index.
|
String |
createSqlTable(Entity entity,
Backend backend)
Creates the table creation sql code.
|
static CodeFactory |
getInstance()
The singleton.
|
public static CodeFactory getInstance()
public String createColumnPostfix(String javaType, int index)
javaType - the java typeindex - the index starting at 0public String createBindableAnnotation(Attribute attribute)
attribute - the attributepublic String createMethodArgument(Attribute attribute, String value)
attribute - the attributevalue - the argument namepublic String createGetterName(Attribute attribute)
attribute - the attributepublic String createSetterName(Attribute attribute)
attribute - the attributepublic String createGetterName(Relation relation)
relation - the relationpublic String createSetterName(Relation relation)
relation - the relationpublic String createDeclaredJavaType(Relation relation, boolean withinForeignEntity)
relation - the relationwithinForeignEntity - true if we need the type from within the foreign entity,
else from within the relation's entitypublic String createJavaType(Relation relation)
relation - the relationpublic String createSqlTable(Entity entity, Backend backend) throws ModelException
entity - the entitybackend - the backend to create sql code forModelException - if model inconsistentpublic String createSqlIndex(Backend backend, Entity entity, Index index)
backend - the database backendentity - the entityindex - the indexpublic String createSqlForeignKey(ForeignKey foreignKey, Backend backend)
foreignKey - the foreign keybackend - the backend to create sql code forTentackle - distributed, domain- and model-driven