Package schema2template.template
Class SourceCodeModel
java.lang.Object
schema2template.template.SourceCodeModel
Model for Java specific enhancements like common base classes for elements and Java value types
for value types used in schema. Encapsulates information from the grammar-additions.xml file.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetBaseChild
(String childName) Use in templates: Get base name for the element name, which shared attributes are being moved into basegetBaseClass
(String baseName) Use in templates: Get baseclass by namegetBaseClass
(PuzzleComponent base) Use in templates: Get baseclass by nameUse in templates: Get all baseclassesgetBaseClassOf
(PuzzleComponent childElement) Use in templates: Get base class of one elementgetBaseName
(String elementName) Use in templates: Get base name for the element name, which shared attributes are being moved into basegetConversiontype
(String datatypename) Use in templates: Get Java conversion class for datatype used in schema.getConversiontype
(PuzzleComponent datatype) Use in templates: Get Java conversion class for datatype used in schema.getPrimitiveType
(String objectType) Use in templates: Translate Java object to simple Java datatypegetSuperClass
(String childName) Use in templates: Get fully qualified super class namegetSuperClassName
(String childName) Use in templates: Get super class name (without Java package)getSuperClassPackageName
(String childName) Use in templates: Get Source code value type for datatype used in schemagetValuetype
(PuzzleComponent datatype) Use in templates: Get Source code value type for datatype used in schemagetValuetypes
(PuzzleComponent datatypes) Use in templates: Get source code value types for datatypes used in schemaboolean
hasSuperClass
(String childName) Use in templates: Check for super class
-
Constructor Details
-
SourceCodeModel
public SourceCodeModel(XMLModel schemaModel, Map<String, String> elementNameBaseNameMap, Map<String, String> elementSuperClassNameMap, Map<String, String[]> datatypeValueAndConversionMap) Construct SourceCodeModel. Not meant for template usage.- Parameters:
schemaModel
- the XMLModel (grammar model)elementNameBaseNameMap
- the mapping from element names to source code base class namesdatatypeValueAndConversionMap
- the mapping from schema datatype to {source code types, name of conversion class}
-
-
Method Details
-
getBaseName
Use in templates: Get base name for the element name, which shared attributes are being moved into base- Returns:
- base name
-
getBaseChild
Use in templates: Get base name for the element name, which shared attributes are being moved into base- Returns:
- base name
-
getBaseClassOf
Use in templates: Get base class of one element- Parameters:
childElement
- element- Returns:
- baseclass
-
getBaseClasses
Use in templates: Get all baseclasses- Returns:
- all baseclasses
-
getBaseClass
Use in templates: Get baseclass by name- Parameters:
baseName
- name of baseclass- Returns:
- sourceCodeBaseClass object
-
getBaseClass
Use in templates: Get baseclass by name- Parameters:
base
- name of baseclass- Returns:
- baseclass object
-
getValuetype
Use in templates: Get Source code value type for datatype used in schema- Parameters:
datatype
-- Returns:
- source code value type
-
hasSuperClass
Use in templates: Check for super class- Parameters:
childName
- the name of the defined XML element or attribute- Returns:
- if there has been a super class being specified via 'extends' attribute in the grammar-additions.xml
-
getSuperClass
Use in templates: Get fully qualified super class name- Parameters:
childName
- the name of the defined XML element or attribute- Returns:
- the super class name fully qualified with Java Package as the one being set via 'extends' attribute in the grammar-additions.xml
-
getSuperClassName
Use in templates: Get super class name (without Java package)- Parameters:
childName
- the name of the defined XML element or attribute- Returns:
- the super class name if one was set via 'extends' in the grammar-additions.xml
-
getSuperClassPackageName
Use in templates: Get Source code value type for datatype used in schema- Parameters:
childName
- the name of the defined XML element or attribute- Returns:
- the package name of the super class
-
getValuetypes
Use in templates: Get source code value types for datatypes used in schema- Parameters:
datatypes
- Schema datatypes- Returns:
- the corresponding source code datatypes
-
getPrimitiveType
Use in templates: Translate Java object to simple Java datatype- Parameters:
objectType
- like "Boolean"- Returns:
- simpleType like "boolean"
-
getConversiontype
Use in templates: Get Java conversion class for datatype used in schema.- Parameters:
datatype
- Source code datatype- Returns:
- name of source code conversion class for this datatype
-
getConversiontype
Use in templates: Get Java conversion class for datatype used in schema.- Parameters:
datatypename
- Source code datatypename- Returns:
- name of source code conversion class for this datatype
-