Class ScriptingNormalizer

java.lang.Object
org.iplass.mtp.entity.definition.NormalizerDefinition
org.iplass.mtp.entity.definition.normalizers.ScriptingNormalizer
All Implemented Interfaces:
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:
  • Constructor Details

    • ScriptingNormalizer

      public ScriptingNormalizer()
    • ScriptingNormalizer

      public ScriptingNormalizer(String script)
  • Method Details

    • isAsArray

      public boolean isAsArray()
    • setAsArray

      public void setAsArray(boolean asArray)
    • getScript

      public String getScript()
    • setScript

      public void setScript(String script)