5.7.1.1.3. Miscellaneous Functions
Name |
Description |
Details |
---|---|---|
extendsFromObject |
Returns true if specified model object extends from some other object (using the extends attribute). |
|
getActionType |
||
getHibernateType |
||
getJavaType(String sxmiType) |
Returns the java type that belongs to the given sxmiType |
|
getJavaWrapperClass(String sxmiType) |
Returns the wrapper class (Boolean, Short, Integer etc.) which is part of the java type that belongs to the given sxmiType |
|
isParentOfObject |
Returns true if there are model objects in the current model package which extends from the specified model object. |
|
isPrimitiveJavaType(String sxmiType) |
Returns true if the java type that belongs to the sxmiType is a primitive type(boolean, short, int etc.), otherwise false |
|
length |
?? |
|
packageToPath |
||
propertyExists |
Returns true if the property is present (referenced in the expression), otherwise – false. Example: <attribute name="${attribute.name}" foreach="attribute" access="rw">
<library>javax.persistence.Column</library>
<datatype>${attribute.type}</datatype>
<annotation.getter>${snippet.java.annotation.jpa.column}</annotation.getter>
<annotation.getter>${snippet.java.annotation.jpa.required}</annotation.getter>
<annotation.getter evaluate="true">
${snippet.java.annotation.hibernate.validator.length}</annotation.getter>
<body condition="${propertyExists(${model.property.attribute.entity.default.value})}">
${model.property.attribute.entity.default.value}</body>
<setterBody>${snippet.java.model.operation.setter}</setterBody>
</attribute>
|
|
firstToken(String expression, String token) |
Evaluates the expression, divides the outcome by means of the given token (see java.lang.String.split(token)). Returns the 1st String from the array which that split produces. |
|
getAttributeType(String objectname, String associationPath) |
Finds the type of the attribute which is specified in the last part of associationPath.
|
|
getLastElementFromAssociationPath(String associationPath, Element parentElement) |
Finds the last element by starting with parentElement and following all associations in associationPath.
|
|
getObjectName(String objectname, String associationPath) |
Finds the name of the object, the last part of the associationPath it belongs to. When associationPath is contactPerson.workAddress.streetName, and the objectName is Relatation, and the Relation object has a reference named ‘contactPerson’ (the starting point of the associationPath) it returns the name of the object where streetName (model attribute) belongs to. In this case it returns Address and the Address model object has a attribute named streetName. |
|
getReferenceType(String objectname, String associationPath) |
Finds the type of the reference which is specified in the last part of associationPath.
|
|
getSetterName(String referenceType, String modelObjectName) |
Finds the name of the setter from referenceType of the property modelObjectName. It looks in all modelObjects for an object with name “referenceType”. From this object it looks for a reference with type “modelObjectName”. The setterName is constructed and returned from the name of this reference.example: Example: <model>
<object name="Object1">
<reference name="myObject2" type="Object2" multiplicity="1..1" />
</object>
<object name="Object2">
<reference name=myObject1 type="Object1" multiplicity="0..n" />
</object>
</model>
getSetterName(“Object1”, “Object2”) = setMyObject2 The reference to modelObjectName must have a multiplicity of 0..n or 1..n otherwise a InvalidPatternException is thrown.
|
|
getValue(String expression, String defaultValue) |
Evaluates the expression and returns defaultValue if the outcome of the expression is empty (nil or an empty string) |
|
isAttribute(String objectname, String associationPath) |
Checks the last element of the associationPath and returns true if it’s a model attribute |
|
isReference(String objectname, String associationPath) |
Checks the last element of the associationPath and returns true if it’s a model reference |
|
lastToken() |
Evaluates the expression, divides the outcome by means of the given token (see java.lang.String.split(token)). Returns the last String from the array which that split produces |
|
map(String mapName, String key) |
||
getTokenByIndex(String expression, String token, String tokenNumberString) |
Finds a token in expression, by splitting expression using token as seperator. The tokenNumber is the number of token to find
|