java.lang.Object
org.tentackle.model.CodeFactory
Factory for code snippets used by generators such as wurblets.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateBindableAnnotation(Attribute attribute) Creates source code for the @Bindable-annotation.createDeclaredJavaType(Relation relation, boolean withinForeignEntity) Creates the declared type of a relation.createGetterName(Attribute attribute) Creates the name of the getter for an attribute.createGetterName(Relation relation) Creates the name of the getter for a relation.createJavaType(Relation relation) Creates the java type of a relation.createMethodArgument(Attribute attribute, String value) Creates the source code for a method argument.createSetterName(Attribute attribute) Creates the name of the setter for an attribute.createSetterName(Relation relation) Creates the name of the setter for a relation.createSqlForeignKey(ForeignKey foreignKey, Backend backend) Creates the foreign key creation sql code.createSqlIndex(Backend backend, Entity entity, Index index) Creates the SQL code to create an index.createSqlTable(Entity entity, Backend backend) Creates the table creation sql code.static CodeFactoryThe singleton.
-
Constructor Details
-
CodeFactory
public CodeFactory()
-
-
Method Details
-
getInstance
The singleton.- Returns:
- the singleton
-
createBindableAnnotation
Creates source code for the @Bindable-annotation.- Parameters:
attribute- the attribute- Returns:
- the java code, null if no binding
-
createMethodArgument
Creates the source code for a method argument.- Parameters:
attribute- the attributevalue- the argument name- Returns:
- the java code
- Throws:
ModelException
-
createGetterName
Creates the name of the getter for an attribute.- Parameters:
attribute- the attribute- Returns:
- the getter name
-
createSetterName
Creates the name of the setter for an attribute.- Parameters:
attribute- the attribute- Returns:
- the setter name
-
createGetterName
Creates the name of the getter for a relation.- Parameters:
relation- the relation- Returns:
- the getter name
-
createSetterName
Creates the name of the setter for a relation.- Parameters:
relation- the relation- Returns:
- the setter name
-
createDeclaredJavaType
Creates the declared type of a relation.- Parameters:
relation- the relationwithinForeignEntity- true if we need the type from within the foreign entity, else from within the relation's entity- Returns:
- the declared java type
-
createJavaType
Creates the java type of a relation.- Parameters:
relation- the relation- Returns:
- the java type
-
createSqlTable
Creates the table creation sql code.- Parameters:
entity- the entitybackend- the backend to create sql code for- Returns:
- the SQL code
- Throws:
ModelException- if model inconsistent
-
createSqlIndex
Creates the SQL code to create an index.- Parameters:
backend- the database backendentity- the entityindex- the index- Returns:
- the SQL code
-
createSqlForeignKey
Creates the foreign key creation sql code.- Parameters:
foreignKey- the foreign keybackend- the backend to create sql code for- Returns:
- the SQL code
-