4.7.3. Freemarker context object: metafactory

With the context object “metafactory” all the methods from a template engine can be called.

Method Summary

Table 4.41 All Methods: Instance Methods and Abstract Methods

Modifier and Type

Method

Description

void

addAttribute(IXMIAttribute sxmiAttribute)

void

addAttribute(IXMIInterface sxmiInterface, IXMIAttribute sxmiAttribute)

void

addAttributeToClass(IXMIAttribute sxmiAttribute)

void

addAttributeToInterface(IXMIAttribute sxmiAttribute)

void

addLibrary(IXMIClass sxmiClass, String library)

void

addLibrary(String library)

void

addLibraryToClass(String library)

void

addLibraryToInterface(String library)

void

addOperation(IXMIClass sxmiClass, IXMIOperation sxmiOperation)

void

addProperty(org.jdom2.Element element, String propertyName)

void

addProperty(org.jdom2.Element element, String propertyName, int propertyValue, org.jdom2.Namespace namespace)

void

addProperty(org.jdom2.Element element, String propertyName, String propertyValue)

List<?>

createEmptyList()

 Create an empty Freemarker list.

Map<?, ?>

createEmptyMap()

Create an empty Freemarker map.

boolean

elementContainsProperty(org.jdom2.Element element, String propertyName)

Check if a property propertyName exist in the element of the pattern or model.

boolean

elementContainsProperty(org.jdom2.Element element, String propertyName, String propertyValue)

Check if a property propertyName exist in the element of the pattern or model. If the property is not found the returned value will be propertyValue

void

error(String message)

String

evaluateFreeMarkerSnippet(String snippetName)

String

evaluateFreeMarkerSnippet(String snippetName, String defaultContent)

org.jdom2.Element

findChildByAttribute(org.jdom2.Element parent, String type, String attributeName, String attributeValue)

org.jdom2.Element

findChildByProperty(org.jdom2.Element parent, String type, String propertyName)

org.jdom2.Element

findChildByProperty(org.jdom2.Element parent, String type, String propertyName, String propertyValue)

List<org.jdom2.Element>

findChildrenByAttribute(org.jdom2.Element parent, String type, String attributeName, String attributeValue)

List<org.jdom2.Element>

findChildrenByProperty(org.jdom2.Element parent, String type, String propertyName)

List<org.jdom2.Element>

findChildrenByProperty(org.jdom2.Element parent, String type, String propertyName, String propertyValue)

List<org.jdom2.Element>

getChildrenWith(org.jdom2.Element parentElement, String childType, String selectorType, String selectorName, String value)

String

getElementProperty(org.jdom2.Element element, String propertyName)

 Check if property propertyName exist in the element of the pattern or model. If the property exist the value is returned, if not found an error occurs.

String

getElementProperty(org.jdom2.Element element, String propertyName, String defaultValue)

Check if a property propertyName exist in the element of the pattern or model. If the property exist the value is returned, if not found the property is added and get the value defaultValue

int

getElementPropertyAsInt(org.jdom2.Element element, String propertyName, int defaultValue)

Check if property propertyName exist in the element of the pattern or model. If the property exist the value is returned as an Integer value. If  not found the property is added  and get the integer value defaultValue

List<org.jdom2.Element>

getModelAttributesWithProperty(String propertyName)

A list of all the attribute in the model which object attributes have a property propertyName

List<org.jdom2.Element>

getModelAttributesWithProperty(String propertyName, String propertyValue)

A list of all the attribute in the model which object attributes have a property propertyName and the specific value  propertyValue

org.jdom2.Element

getModelAttributeWithProperty(String propertyName)

org.jdom2.Element

getModelAttributeWithProperty(String propertyName, String propertyValue)

String

getModelObjectPropertyValue(String objectName, String key)

List<org.jdom2.Element>

getModelObjectsWithProperty(String propertyName)

A list of all the objects in the model which object  have a property propertyName

List<org.jdom2.Element>

getModelObjectsWithProperty(String propertyName, String propertyValue)

A list of all the objects in the model which object have a property propertyName and the specific value  propertyValue

List<org.jdom2.Element>

getModelOperationsWithProperty(String propertyName)

List<org.jdom2.Element>

getModelOperationsWithProperty(String propertyName, String propertyValue)

List<org.jdom2.Element>

getModelPackagesWithProperty(String propertyName)

List<org.jdom2.Element>

getModelPackagesWithProperty(String propertyName, String propertyValue)

List<org.jdom2.Element>

getModelReferencesWithProperty(String propertyName)

A list of all the references in the model which object references have a property propertyName

List<org.jdom2.Element>

getModelReferencesWithProperty(String propertyName, String propertyValue)

A list of all the references in the model which object references have a property propertyName and the specific value  propertyValue

org.jdom2.Element

getModelReferenceWithProperty(String propertyName)

org.jdom2.Element

getModelReferenceWithProperty(String propertyName, String propertyValue)

List<org.jdom2.Element>

getPropertyElements(org.jdom2.Element element, String propertyName)

boolean

isModelChanged()

void

IXMIOperation sxmiOperation)

void

log(String message)

Table 4.42 All Methods Instance Methods Abstract Methods

Modifier and Type

Method and Description

String

allLower(String variable)

String

allUpper(String variable)

List<Object>

asList(Object[] someArray)

String

camelToAllUpperUnderscore(String variable)

String

decapitalize(String var, String sLength)

String

evaluateExpression(String key)

String

evaluateSnippet(String snippetName,String defaultContent)

String

firstLower(String variable)

String

firstToken(String expression, String token)

String

firstUpper(String variable)

String

getAttributeType(String objectname, String associationPath)

String

getHibernateType(String sxmiType)

String

getJavaType(String sxmiType)

String

getJavaWrapperClass(String sxmiType)

org.jdom2.Element

getLastElementFromAssociationPath(String associationPath, org.jdom2.Element parentObjectElement)

String

getReferenceType(String objectname, String associationPath)

String

getSetterName(String referenceType, String modelObjectName)

String

getTokenByIndex(String expression, String token, int tokenNumber)

String

getTokenByIndex(String expression, String token, String tokenNumberString)

String

getValue(String[] arguments)

String

getValueFromMap(String mapName, String key)

boolean

isPrimitiveJavaType(String sxmiType)

String

lastToken(String expression, String token)

String

lastToken(String[] arguments)

String

length(String variable)

String

packageToPath(String packageName)

List<?>

sort(List<? super Object> list, Comparator<? super Object> comparator)

Table 4.43 All Methods Instance Methods Abstract Methods Deprecated

String

evaluateExpression(String key)

String

evaluateExpression(String key, IContextProxy context)

Cross S Deprecated

String

evaluateExpression(String key, IContextProxy context, String defaultValue)

Cross S Deprecated

String

evaluateExpression(String key, String defaultValue)

String

evaluateFreeMarkerSnippet(String snippetName)

String

evaluateFreeMarkerSnippet(String snippetName, String defaultContent)

String

evaluateSnippet(String snippetName)

String

evaluateSnippet(String snippetName, IContextProxy context, String defaultContent)

Cross S Deprecated

String

evaluateSnippet(String snippetName, String defaultContent)