Class ScriptingNormalizer
java.lang.Object
org.iplass.mtp.entity.definition.NormalizerDefinition
org.iplass.mtp.entity.definition.normalizers.ScriptingNormalizer
- All Implemented Interfaces:
java.io.Serializable
public class ScriptingNormalizer extends NormalizerDefinition
This is the Normalizer definition by Script.
It is implemented to return the normalized value.
When the asArray flag is set to true, if the validation target is an array,
it will be passed as an array to the value of the Normalizer Script.
Variables that can be referenced from within the script
- entity:Instance of the Entity
- propertyName:The property name to be normalized of the Entity
- value:Value of the property of the Entity instance to be normalized
- context:An instance of ValidationContext
Script Code Example
if (value == null) {
return null;
}
if (!value.startsWith('p_') {
return 'p_' + value;
} else {
return value;
}
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description ScriptingNormalizer()ScriptingNormalizer(java.lang.String script) -
Method Summary
Modifier and Type Method Description java.lang.StringgetScript()booleanisAsArray()voidsetAsArray(boolean asArray)voidsetScript(java.lang.String script)
-
Constructor Details
-
ScriptingNormalizer
public ScriptingNormalizer() -
ScriptingNormalizer
public ScriptingNormalizer(java.lang.String script)
-
-
Method Details
-
isAsArray
public boolean isAsArray() -
setAsArray
public void setAsArray(boolean asArray) -
getScript
public java.lang.String getScript() -
setScript
public void setScript(java.lang.String script)
-