DOC
- the document typepublic final class TranslatorSupport<DOC extends Document & HasName & HasMainInterface> extends Object
Translator
interface that holds various
naming methods used in the translator implementations.
This class might be refactored later on to separate methods that require the document and those that do not in separate files.
Modifier and Type | Field and Description |
---|---|
static String |
GENERATED_PACKAGE |
static String |
GENERATED_PREFIX |
static String |
IMPL_SUFFIX |
static String |
MANAGER_SUFFIX |
Constructor and Description |
---|
TranslatorSupport(Speedment speedment,
DOC document) |
Modifier and Type | Method and Description |
---|---|
String |
baseDirectoryName()
Returns the base directory name of the current node.
|
String |
basePackageName()
Returns the base package name of the current node.
|
Optional<Column> |
column()
Return this node or any ancestral node that is a
Column . |
Column |
columnOrThrow()
Return this node or any ancestral node that is a
Column . |
Optional<Dbms> |
dbms()
Return this node or any ancestral node that is a
Dbms . |
Dbms |
dbmsOrThrow()
Return this node or any ancestral node that is a
Dbms . |
protected DOC |
document() |
String |
entityImplName() |
Type |
entityImplType() |
String |
entityName() |
Type |
entityType() |
String |
fullyQualifiedTypeName()
Returns the fully qualified type name of the current document.
|
String |
fullyQualifiedTypeName(String subPath)
Returns the fully qualified type name of the current document.
|
String |
fullyQualifiedTypeName(String subPath,
String filePrefix)
Returns the fully qualified type name of the current document.
|
String |
generatedEntityImplName() |
Type |
generatedEntityImplType() |
String |
generatedEntityName() |
Type |
generatedEntityType() |
String |
generatedManagerImplName() |
Type |
generatedManagerImplType() |
String |
generatedManagerName() |
Type |
generatedManagerType() |
String |
managerImplName() |
Type |
managerImplType() |
String |
managerName() |
Type |
managerType() |
String |
managerTypeName()
Returns the alias of the current document as a java type but with the
keyword 'Manager' appended to it.
|
String |
managerTypeName(HasAlias doc)
Returns the alias of the specified document as a java type but with the
keyword 'Manager' appended to it.
|
JavaLanguageNamer |
namer() |
Optional<Project> |
project()
Return this node or any ancestral node that is a
Project . |
Project |
projectOrThrow()
Return this node or any ancestral node that is a
Project . |
Optional<Schema> |
schema()
Return this node or any ancestral node that is a
Schema . |
Schema |
schemaOrThrow()
Return this node or any ancestral node that is a
Schema . |
Speedment |
speedment() |
Optional<Table> |
table()
Return this node or any ancestral node that is a
Table . |
Table |
tableOrThrow()
Return this node or any ancestral node that is a
Table . |
String |
typeName()
Returns the alias of the current document formatted as a java type.
|
String |
typeName(HasAlias doc)
Returns the alias of the specified document formatted as a java type.
|
String |
typeName(Project project)
Returns the name of the specified project formatted as a java type.
|
String |
variableName()
Returns the alias of the current document formatted as a java variable.
|
String |
variableName(HasAlias doc)
Returns the alias of the specified document formatted as a java variable.
|
public static final String IMPL_SUFFIX
public static final String MANAGER_SUFFIX
public static final String GENERATED_PACKAGE
public static final String GENERATED_PREFIX
public Speedment speedment()
public JavaLanguageNamer namer()
protected DOC document()
public String entityName()
public String entityImplName()
public String generatedEntityName()
public String generatedEntityImplName()
public String managerName()
public String managerImplName()
public String generatedManagerName()
public String generatedManagerImplName()
public Type entityType()
public Type entityImplType()
public Type generatedEntityType()
public Type generatedEntityImplType()
public Type managerType()
public Type managerImplType()
public Type generatedManagerType()
public Type generatedManagerImplType()
public String variableName()
Example:
employeesSchema
userTable
firstname
document()
public String variableName(HasAlias doc)
Example:
employeesSchema
userTable
firstname
doc
- the document to retrieve the name from.public String typeName()
Example:
EmployeesSchema
UserTable
Firstname
document()
public String typeName(HasAlias doc)
Example:
EmployeesSchema
UserTable
Firstname
doc
- the document to retrieve the alias frompublic String typeName(Project project)
Example:
EmployeesSchema
UserTable
Firstname
project
- the document to retrieve the name frompublic String managerTypeName()
Example:
EmployeesSchemaManager
UserTableManager
FirstnameManager
document()
public String managerTypeName(HasAlias doc)
Example:
EmployeesSchemaManager
UserTableManager
FirstnameManager
doc
- the document to retrieve the alias frompublic String fullyQualifiedTypeName()
Example:
com.speedment.example.employeesschema.EmployeesSchema
com.speedment.example.usertable.UserTable
com.speedment.example.usertable.firstname.Firstname
Note that this method is only meant to work with documents at
Table
or higher level in the hierarchy. It will return a
result for all documents located in a valid hierarchy, but the result
might not be as intended.
public String fullyQualifiedTypeName(String subPath)
Example:
com.speedment.example.employeesschema.EmployeesSchema
com.speedment.example.usertable.UserTable
com.speedment.example.usertable.firstname.Firstname
Note that this method is only meant to work with nodes at
Table
or higher level in the hierarchy. It will return a
result for all documents located in a valid hierarchy, but the result
might not be as intended.
subPath
- A sub-path to be added at the end of the 'package'-part
of the qualified type name. This value can be
null
and in that case an ordinary
fullyQualifiedTypeName
will be returned.public String fullyQualifiedTypeName(String subPath, String filePrefix)
Example:
com.speedment.example.employeesschema.EmployeesSchema
com.speedment.example.usertable.UserTable
com.speedment.example.usertable.firstname.Firstname
Note that this method is only meant to work with nodes at Table
or higher level in the hierarchy. It will return a result for all
documents located in a valid hierarchy, but the result might not be as
intended.
subPath
- a prefix that will be added to the "class"-part of the
type namefilePrefix
- a sub-path to be added at the end of the
'package'-part of the qualified type name. This value
can be null
and in that case an ordinary
fullyQualifiedTypeName
will be returned.public String basePackageName()
public String baseDirectoryName()
basePackageName()
but with dashes ('/') instead of
dots ('.').public Optional<Project> project()
Project
. If no
such node exists, an empty Optional
is returned.public Optional<Dbms> dbms()
Dbms
. If no such
node exists, an empty Optional
is returned.public Optional<Schema> schema()
Schema
. If no
such node exists, an empty Optional
is returned.public Optional<Table> table()
Table
. If no
such node exists, an empty Optional
is returned.public Optional<Column> column()
Column
. If no
such node exists, an empty Optional
is returned.public Project projectOrThrow()
Project
. If no
such node exists, an IllegalStateException
is thrown.IllegalStateException
- if there was no projectpublic Dbms dbmsOrThrow()
Dbms
. If no
such node exists, an IllegalStateException
is thrown.IllegalStateException
- if there was no dbmspublic Schema schemaOrThrow()
Schema
. If no
such node exists, an IllegalStateException
is thrown.IllegalStateException
- if there was no schemapublic Table tableOrThrow()
Table
. If no
such node exists, an IllegalStateException
is thrown.IllegalStateException
- if there was no tablepublic Column columnOrThrow()
Column
. If no
such node exists, an IllegalStateException
is thrown.IllegalStateException
- if there was no columnCopyright © 2016 Speedment, Inc.. All rights reserved.