5.9.1. Freemarker and Velocity Context Variables

Hammer L Verwijzingen invoegen

With these context objects the patterns can build the code that we want to be be generated.

Table 5.64 Context Variables

Context object

Type

Details

attributePattern

Exclam S todo update

classPattern

Exclam S todo update

comparatorFactory

com.metafactory.api.IComparatorFactory

no description

context

com.metafactory.api.IContextProxy

no description

filePattern

Exclam S todo update

foreachAttribute

java.lang.Boolean

In the pattern the foreachAttribute iterates over all the attribute elements of the object element in scope.

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.

foreachOperation

java.lang.Boolean

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.

forEachPropertyValue

java.lang.String

foreachReference

java.lang.Boolean

In the pattern the foreachReference iterates over all the reference elements of the object element in scope.

generatedAttribute

Exclam S todo update

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.

generatedClass

Exclam S todo update

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.

generatedInterface

Exclam S todo update

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.

generatedOperation

Exclam S todo update

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.

generatedPackage

Exclam S todo update

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.

interfacePattern

Exclam S todo update

metafactory

com.metafactory.api.IMetaFactoryTemplateEngineProxy

Contains all methods which can be called from a template engine like Velocity or Freemarker.

model

ModelRoot

The complete model as read from model.xml or from another format (xml and yaml are supported right now).

modelAttribute

ModelAttribute

The actual attribute of the MetaFactory model used in the pattern. Used when foreach=”attribute”.

modelAttributeProperties

java.util.Properties

modelObject

ModelObject

The actual object of the MetaFactory model used in the pattern. Used when foreach=”object”.

modelOperationProperties

java.util.Properties

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.

modelProperties

java.util.Properties

modelReference

ModelReference

The actual reference of the MetaFactory model used in the pattern. Used when foreach=”reference”.

modelReferenceProperties

java.util.Properties

nsPattern

org.jdom2.Namespace

The namespace of the MetaFactory pattern.

operationPattern

Exclam S todo update

packagePattern

Exclam S todo update

 hiermee verwijs je naar de xml pattern

var0

java.lang.String

var1

java.lang.String

var2

java.lang.String

var3

java.lang.String

var4

java.lang.String

var5

java.lang.String

var6

java.lang.String

var7

java.lang.String

var8

java.lang.String

var9

java.lang.String

var10

java.lang.String

var11

java.lang.String

var12

java.lang.String

var13

java.lang.String

var14

java.lang.String

var15

java.lang.String

var16

java.lang.String

var17

java.lang.String

var18

java.lang.String

var19

java.lang.String

var20

java.lang.String

xmlElementPattern

org.jdom2.Element

byte

java.lang.Byte

short

java.lang.Short

integer

java.lang.Integer

long

java.lang.Long

biginteger

java.math.BigInteger

float

java.lang.Float

double

java.lang.Double

bigdecimal

java.math.BigDecimal

stringUtils

org.apache.commons.lang.StringUtils