Package schema2template.template
Class SourceCodeModel
- java.lang.Object
-
- schema2template.template.SourceCodeModel
-
public class SourceCodeModel extends Object
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.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getBaseChild(String childName)
Use in templates: Get base name for the element name, which shared attributes are being moved into baseSourceCodeBaseClass
getBaseClass(String baseName)
Use in templates: Get baseclass by nameSourceCodeBaseClass
getBaseClass(PuzzleComponent base)
Use in templates: Get baseclass by nameSortedSet<SourceCodeBaseClass>
getBaseClasses()
Use in templates: Get all baseclassesSourceCodeBaseClass
getBaseClassOf(PuzzleComponent childElement)
Use in templates: Get base class of one elementString
getBaseName(String elementName)
Use in templates: Get base name for the element name, which shared attributes are being moved into baseString
getConversiontype(String datatypename)
Use in templates: Get Java conversion class for datatype used in schema.String
getConversiontype(PuzzleComponent datatype)
Use in templates: Get Java conversion class for datatype used in schema.String
getPrimitiveType(String objectType)
Use in templates: Translate Java object to simple Java datatypeString
getSuperClass(String childName)
Use in templates: Get fully qualified super class nameString
getSuperClassName(String childName)
Use in templates: Get super class name (without Java package)String
getSuperClassPackageName(String childName)
Use in templates: Get Source code value type for datatype used in schemaString
getValuetype(PuzzleComponent datatype)
Use in templates: Get Source code value type for datatype used in schemaSortedSet<String>
getValuetypes(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 Detail
-
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 Detail
-
getBaseName
public String getBaseName(String elementName)
Use in templates: Get base name for the element name, which shared attributes are being moved into base- Returns:
- base name
-
getBaseChild
public String getBaseChild(String childName)
Use in templates: Get base name for the element name, which shared attributes are being moved into base- Returns:
- base name
-
getBaseClassOf
public SourceCodeBaseClass getBaseClassOf(PuzzleComponent childElement)
Use in templates: Get base class of one element- Parameters:
childElement
- element- Returns:
- baseclass
-
getBaseClasses
public SortedSet<SourceCodeBaseClass> getBaseClasses()
Use in templates: Get all baseclasses- Returns:
- all baseclasses
-
getBaseClass
public SourceCodeBaseClass getBaseClass(String baseName)
Use in templates: Get baseclass by name- Parameters:
baseName
- name of baseclass- Returns:
- sourceCodeBaseClass object
-
getBaseClass
public SourceCodeBaseClass getBaseClass(PuzzleComponent base)
Use in templates: Get baseclass by name- Parameters:
base
- name of baseclass- Returns:
- baseclass object
-
getValuetype
public String getValuetype(PuzzleComponent datatype)
Use in templates: Get Source code value type for datatype used in schema- Parameters:
datatype
-- Returns:
- source code value type
-
hasSuperClass
public boolean hasSuperClass(String childName)
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
public String getSuperClass(String childName)
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
public String getSuperClassName(String childName)
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
public String getSuperClassPackageName(String childName)
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
public SortedSet<String> getValuetypes(PuzzleComponent datatypes)
Use in templates: Get source code value types for datatypes used in schema- Parameters:
datatypes
- Schema datatypes- Returns:
- the corresponding source code datatypes
-
getPrimitiveType
public String getPrimitiveType(String objectType)
Use in templates: Translate Java object to simple Java datatype- Parameters:
objectType
- like "Boolean"- Returns:
- simpleType like "boolean"
-
getConversiontype
public String getConversiontype(PuzzleComponent datatype)
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
-
-