MENU

  /   Freemarker

Freemarker

MetaFactory uses Apaches Freemarker template engine in order to let the patterns and the snippets generate the desired code.

Freemarker (and Velocity) context variables

With these context objects the patterns can build the code to be generated. the patterns can be written to make decisions depending on the values and properties of these context objects.

The MetaFactory freemarker context objects available are listed in the table below.

Context object Type Details
model ModelRoot The complete model as read from model.xml or from another format (xml and yaml are supported right now).
modelPackage ModelPackage The actual package of the MetaFactory model used in the pattern. The package can be set by the package attribute in the pattern.
modelObject ModelObject The actual object of the MetaFactory model used in the pattern. Used when foreach=”object”.
modelAttribute ModelAttribute The actual attribute of the MetaFactory model used in the pattern. Used when foreach=”attribute”.
modelReference ModelReference The actual reference of the MetaFactory model used in the pattern. Used when foreach=”reference”.
var0 java.lang.String
var1 java.lang.String
var2 java.lang.String
var3 java.lang.String
var4 java.lang.String
var5 java.lang.String
metafactory com.metafactory.api.IMetaFactoryTemplateEngineProxy Contains all methods which can be called from a template engine like Velocity or Freemarker.
context com.metafactory.api.IContextProxy no description
nsPattern org.jdom2.Namespace The namespace of the MetaFactory pattern.
packagePattern org.jdom2.Element  hiermee verwijs je naar de xml pattern
classPattern org.jdom2.Element
interfacePattern org.jdom2.Element
attributePattern org.jdom2.Element
operationPattern org.jdom2.Element
comparatorFactory com.metafactory.api.IComparatorFactory no description
previousPackage ModelPackage A reference to the previous model package used (seldom needed).
previousObject ModelObject A reference to the previous model object used (seldom needed).
foreachPackage java.lang.Boolean In the pattern the foreachPackage iterates over all the packages in the scope of the model. So some pattern part or snippet can be done for all the packages. So all the package elements of the model.xml file will be addressed.
foreachObject java.lang.Boolean In the pattern the foreachObject iterates over all the objects in the scope of the parent element in the model. So some pattern part or snippet can be done for all the objects in scope.
foreachAttribute java.lang.Boolean In the pattern the foreachAttribute iterates over all the attribute elements of the object element in scope.
foreachReference java.lang.Boolean In the pattern the foreachReference iterates over all the reference elements of the object element in scope.
foreachOperation java.lang.Boolean
forEachPropertyValue java.lang.String
generatedPackage org.sxmi.wrapper.api.IXMIPackage In the scope of the interface element of the actual package during generation this generatedPackage provides access to methods to get information of this package element.
generatedInterface org.sxmi.wrapper.api.IXMIInterface In the scope of the interface element of the actual package during generation this generatedInterface provides access to methods to get information of this interface element.
generatedClass org.sxmi.wrapper.api.IXMIClass In the scope of the class element of the actual pattern during generation this generatedClass provides access to methods and to get information of this class element.
generatedAttribute org.sxmi.wrapper.api.IXMIAttribute In the scope of the attribute element of the actual pattern during generation this generatedAttribute provides access to methods to get information of this attribute element.
generatedOperation org.sxmi.wrapper.api.IXMIOperation In the scope of the operation element in the actual pattern during generation this generatedOperation provides access to methods to get information of this operation element.
modelProperties java.util.Properties
modelAttributeProperties java.util.Properties
modelOperationProperties java.util.Properties
modelReferenceProperties java.util.Properties
byte java.lang.Byte
short java.lang.Short
integer java.lang.Integer
long java.lang.Long
float java.lang.Float
double java.lang.Double
bigdecimal java.math.BigDecimal
biginteger java.math.BigInteger
stringUtils org.apache.commons.lang.StringUtils
xmlElementPattern org.jdom2.Element
filePattern org.jdom2.Element