public class GeneratorHelper extends Object
| Constructor and Description |
|---|
GeneratorHelper(MolgenisOptions options) |
| Modifier and Type | Method and Description |
|---|---|
static String |
escapeXml(String nonXml) |
static String |
firstToLower(String string)
Convert string with first character to lowercase.
|
static String |
firstToUpper(String string)
Convert string with first character to uppercase.
|
Vector<Field> |
getAddFields(Entity e) |
Vector<Field> |
getAddFields(Entity e,
boolean includeKey)
Get the fields that participate in an insert (so excluding automatic fields).
|
Vector<Field> |
getAllFields(Entity e) |
Vector<Field> |
getAllFields(Entity e,
String type) |
Vector<Unique> |
getAllKeys(Entity e) |
String |
getCppJavaType(Field field)
Get the cpp type for a field.
|
String |
getCppType(Field field)
Get the cpp type for a field.
|
Vector<Field> |
getDbFields(Entity e,
String type)
The table fields of this entity
|
String |
getDefault(Model model,
Field field)
Creates a default value based on the default values set in the model.
|
FieldType |
getFieldType(Model model,
Field field) |
String |
getHsqlType(Field field) |
String |
getImports(Model m,
Entity e,
String subpackage,
String suffix) |
String |
getJavaAssignment(Field field,
String value) |
static String |
getJavaName(String name)
First character to upercase.
|
static String |
getJavaName(String name,
boolean doFirstToUpper) |
Vector<Field> |
getKeyFields(Entity e) |
Vector<Field> |
getKeyFields(List<Unique> keys)
Return all secondary key fields.
|
Vector<Field> |
getKeyFields(Unique u) |
String |
getMysqlType(Model model,
Field field)
Get the mysql type of a field: VARCHAR, INT, etc.
|
String |
getOracleType(Model model,
Field field) |
Vector<Field> |
getSecondaryKeyFields(Entity e) |
Vector<Unique> |
getSecondaryKeys(Entity e)
Return all secondary keys for an entity
|
String |
getSetType(Model model,
Field field)
Java setter type of the field, e.g.
|
List<Entity> |
getSubclasses(Entity superclass,
Model m) |
List<Entity> |
getSuperclasses(Entity subclass,
Model m) |
Vector<Unique> |
getTableKeys(Entity e)
A table can only contain the keys for columns that are actually in the table.
|
String |
getType(Field field)
Get the java type for a field.
|
String |
getTypeFieldName() |
Vector<Field> |
getUpdateFields(Entity e) |
Vector<Field> |
getViewFields(Entity e,
String type)
The queryable fields of the entity (in case of inheritance from the view join)
|
Field |
getXrefField(Model model,
Field e) |
String |
getXsdType(Model model,
Field field) |
boolean |
isPrimaryKey(Field f,
Entity e) |
String |
parseQueryOperator(String label) |
String |
pluralOf(String string) |
String |
toCsv(List<String> elements)
Convert a list of string to comma separated values.
|
static String |
toLower(String string)
Convert string to full lowercase
|
static String |
toUpper(String string)
Convert string to full uppercase
|
public GeneratorHelper(MolgenisOptions options)
public static String firstToUpper(String string)
string - public static String firstToLower(String string)
string - public static String toUpper(String string)
string - public static String toLower(String string)
string - public String getType(Field field) throws Exception
Exceptionpublic String getCppType(Field field) throws Exception
Exceptionpublic String getCppJavaType(Field field) throws Exception
Exceptionpublic String getSetType(Model model, Field field) throws Exception
model - field - Exceptionpublic String getDefault(Model model, Field field) throws Exception
model - Meta modelfield - Meta model of a field (question: couldn't we ask the field for this??)Exceptionpublic String getJavaAssignment(Field field, String value) throws MolgenisModelException
MolgenisModelExceptionpublic String toCsv(List<String> elements)
elements - public String getMysqlType(Model model, Field field) throws Exception
model - field - Exceptionpublic String getOracleType(Model model, Field field) throws Exception
Exceptionpublic Vector<Field> getAddFields(Entity e, boolean includeKey) throws Exception
e - includeKey - Exceptionpublic Vector<Field> getAllFields(Entity e, String type) throws Exception
Exceptionpublic Vector<Field> getDbFields(Entity e, String type) throws Exception
Exceptionpublic Vector<Field> getViewFields(Entity e, String type) throws Exception
e - type - Exceptionpublic boolean isPrimaryKey(Field f, Entity e) throws MolgenisModelException
MolgenisModelExceptionpublic Vector<Field> getKeyFields(Entity e) throws MolgenisModelException
MolgenisModelExceptionpublic Vector<Unique> getAllKeys(Entity e) throws MolgenisModelException
MolgenisModelExceptionpublic Vector<Unique> getSecondaryKeys(Entity e) throws MolgenisModelException
e - entityMolgenisModelExceptionpublic Vector<Field> getKeyFields(List<Unique> keys) throws MolgenisModelException
keys - list of Unique definitionsMolgenisModelExceptionpublic Vector<Field> getSecondaryKeyFields(Entity e) throws MolgenisModelException
MolgenisModelExceptionpublic Vector<Field> getKeyFields(Unique u) throws MolgenisModelException
MolgenisModelExceptionpublic Vector<Unique> getTableKeys(Entity e) throws MolgenisModelException
e - MolgenisModelExceptionpublic FieldType getFieldType(Model model, Field field) throws Exception
Exceptionpublic static String getJavaName(String name)
name - public String getImports(Model m, Entity e, String subpackage, String suffix) throws MolgenisModelException
MolgenisModelExceptionpublic String getTypeFieldName()
Copyright © 2015. All Rights Reserved.