public final class EmitContext extends Object
| Constructor and Description |
|---|
EmitContext(DmdlSemantics semantics,
Configuration config,
ModelDeclaration model,
String categoryName,
String typeNamePattern)
Creates and returns a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
SimpleName |
createVariableName(String hint)
Returns a variable name which is different to other property names.
|
void |
emit(TypeDeclaration type)
Emits the type declaration as the suitable Java source program.
|
Configuration |
getConfiguration()
Returns the current configuration.
|
Type |
getContainerType(PropertyReferenceDeclaration reference)
Returns the collection type of target reference.
|
String |
getDescription(Declaration declaration)
Returns the description text of the declaration.
|
Type |
getElementType(PropertyReferenceDeclaration reference)
Returns the element type of target reference.
|
Expression |
getFieldInitializer(PropertyDeclaration property)
Returns the corresponded property initializer.
|
SimpleName |
getFieldName(MemberDeclaration property)
Returns the corresponded property name.
|
Type |
getFieldType(PropertyDeclaration property)
Returns the corresponded property data type.
|
static Class<?> |
getFieldTypeAsClass(BasicTypeKind type)
Returns the corresponded property data type as related class object.
|
static Class<?> |
getFieldTypeAsClass(PropertyDeclaration property)
Returns the corresponded property data type as related class object.
|
ModelFactory |
getModelFactory()
Returns Java DOM factory in use.
|
SimpleName |
getOptionGetterName(PropertyDeclaration property)
Returns the corresponded option getter name.
|
SimpleName |
getOptionSetterName(PropertyDeclaration property)
Returns the corresponded option setter name.
|
QualifiedName |
getQualifiedTypeName()
Returns the qualified name of processing type.
|
QualifiedName |
getQualifiedTypeName(ModelSymbol model)
Returns the simple name of the target data model class.
|
SimpleName |
getReferenceGetterName(PropertyReferenceDeclaration reference)
Returns the corresponded reference getter name.
|
DmdlSemantics |
getSemantics()
Returns the root semantics model.
|
SimpleName |
getTypeName()
Returns the simple name of processing type.
|
SimpleName |
getTypeName(ModelSymbol model)
Returns the simple name of the target data model class.
|
SimpleName |
getValueGetterName(PropertyDeclaration property)
Returns the corresponded value getter name.
|
SimpleName |
getValueSetterName(PropertyDeclaration property)
Returns the corresponded value setter name.
|
Type |
getValueType(PropertyDeclaration property)
Returns the corresponded property value type.
|
static Class<?> |
getValueTypeAsClass(PropertyDeclaration property)
Returns the corresponded property value type as related class object.
|
Type |
resolve(ModelSymbol model)
Resolves the model symbol to the corresponded Java DOM type symbol.
|
Type |
resolve(Name name)
Resolves the qualified type name to the corresponded type symbol.
|
Type |
resolve(Type type)
Resolves the runtime type to the corresponded Java DOM type symbol.
|
Type |
resolve(Type type)
Resolves the Java DOM type to imported type representation.
|
public EmitContext(DmdlSemantics semantics, Configuration config, ModelDeclaration model, String categoryName, String typeNamePattern)
semantics - the root semantics modelconfig - the configuration of this processingmodel - the model to processcategoryName - the category name of processingtypeNamePattern - the type name pattern in MessageFormat.format(String, Object...)IllegalArgumentException - if some parameters were nullpublic ModelFactory getModelFactory()
public DmdlSemantics getSemantics()
public Configuration getConfiguration()
public SimpleName getTypeName()
public QualifiedName getQualifiedTypeName()
public SimpleName getTypeName(ModelSymbol model)
model - the target symbolpublic QualifiedName getQualifiedTypeName(ModelSymbol model)
model - the target symbolpublic void emit(TypeDeclaration type) throws IOException
type - the declarationIOException - if failed to emit a Java programIllegalArgumentException - if some parameters were nullpublic Type resolve(ModelSymbol model)
model - the model symbolIllegalArgumentException - if some parameters were nullpublic Type resolve(Type type)
type - the runtime typeIllegalArgumentException - if some parameters were nullpublic Type resolve(Name name)
name - the qualified type nameIllegalArgumentException - if some parameters were nullpublic Type resolve(Type type)
type - the Java DOM typeIllegalArgumentException - if some parameters were nullpublic SimpleName getFieldName(MemberDeclaration property)
property - target propertyIllegalArgumentException - if some parameters were nullpublic Type getValueType(PropertyDeclaration property)
property - target propertyIllegalArgumentException - if some parameters were nullpublic static Class<?> getValueTypeAsClass(PropertyDeclaration property)
property - target propertyIllegalArgumentException - if some parameters were nullpublic Type getFieldType(PropertyDeclaration property)
property - target propertyIllegalArgumentException - if some parameters were nullpublic Type getContainerType(PropertyReferenceDeclaration reference)
reference - target referenceIllegalArgumentException - if some parameters were nullpublic Type getElementType(PropertyReferenceDeclaration reference)
reference - target referenceIllegalArgumentException - if some parameters were nullpublic static Class<?> getFieldTypeAsClass(PropertyDeclaration property)
property - target propertyIllegalArgumentException - if some parameters were nullpublic static Class<?> getFieldTypeAsClass(BasicTypeKind type)
type - the typeIllegalArgumentException - if some parameters were nullpublic Expression getFieldInitializer(PropertyDeclaration property)
property - target propertyIllegalArgumentException - if some parameters were nullpublic SimpleName getValueGetterName(PropertyDeclaration property)
property - target propertyIllegalArgumentException - if some parameters were nullpublic SimpleName getValueSetterName(PropertyDeclaration property)
property - target propertyIllegalArgumentException - if some parameters were nullpublic SimpleName getOptionGetterName(PropertyDeclaration property)
property - target propertyIllegalArgumentException - if some parameters were nullpublic SimpleName getOptionSetterName(PropertyDeclaration property)
property - target propertyIllegalArgumentException - if some parameters were nullpublic SimpleName getReferenceGetterName(PropertyReferenceDeclaration reference)
reference - target referenceIllegalArgumentException - if some parameters were nullpublic SimpleName createVariableName(String hint)
hint - the naming hintIllegalArgumentException - if some parameters were nullpublic String getDescription(Declaration declaration)
declaration - the target declarationIllegalArgumentException - if some parameters were nullCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.