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 null
public 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 null
public Type resolve(ModelSymbol model)
model
- the model symbolIllegalArgumentException
- if some parameters were null
public Type resolve(Type type)
type
- the runtime typeIllegalArgumentException
- if some parameters were null
public Type resolve(Name name)
name
- the qualified type nameIllegalArgumentException
- if some parameters were null
public Type resolve(Type type)
type
- the Java DOM typeIllegalArgumentException
- if some parameters were null
public SimpleName getFieldName(MemberDeclaration property)
property
- target propertyIllegalArgumentException
- if some parameters were null
public Type getValueType(PropertyDeclaration property)
property
- target propertyIllegalArgumentException
- if some parameters were null
public static Class<?> getValueTypeAsClass(PropertyDeclaration property)
property
- target propertyIllegalArgumentException
- if some parameters were null
public Type getFieldType(PropertyDeclaration property)
property
- target propertyIllegalArgumentException
- if some parameters were null
public Type getContainerType(PropertyReferenceDeclaration reference)
reference
- target referenceIllegalArgumentException
- if some parameters were null
public Type getElementType(PropertyReferenceDeclaration reference)
reference
- target referenceIllegalArgumentException
- if some parameters were null
public static Class<?> getFieldTypeAsClass(PropertyDeclaration property)
property
- target propertyIllegalArgumentException
- if some parameters were null
public static Class<?> getFieldTypeAsClass(BasicTypeKind type)
type
- the typeIllegalArgumentException
- if some parameters were null
public Expression getFieldInitializer(PropertyDeclaration property)
property
- target propertyIllegalArgumentException
- if some parameters were null
public SimpleName getValueGetterName(PropertyDeclaration property)
property
- target propertyIllegalArgumentException
- if some parameters were null
public SimpleName getValueSetterName(PropertyDeclaration property)
property
- target propertyIllegalArgumentException
- if some parameters were null
public SimpleName getOptionGetterName(PropertyDeclaration property)
property
- target propertyIllegalArgumentException
- if some parameters were null
public SimpleName getOptionSetterName(PropertyDeclaration property)
property
- target propertyIllegalArgumentException
- if some parameters were null
public SimpleName getReferenceGetterName(PropertyReferenceDeclaration reference)
reference
- target referenceIllegalArgumentException
- if some parameters were null
public SimpleName createVariableName(String hint)
hint
- the naming hintIllegalArgumentException
- if some parameters were null
public String getDescription(Declaration declaration)
declaration
- the target declarationIllegalArgumentException
- if some parameters were null
Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.