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.String getScript()  
    boolean isAsArray()  
    void setAsArray​(boolean asArray)  
    void setScript​(java.lang.String script)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait