Class CustomMapTransformer

  • All Implemented Interfaces:
    Transformer

    public final class CustomMapTransformer
    extends java.lang.Object
    implements Transformer
    Allows you to provide a custom map to inject into leaf values that match ${map:key}, where the key is used to lookup into the map.
    • Constructor Summary

      Constructors 
      Constructor Description
      CustomMapTransformer()
      Default CustomMapTransformer that will not replace any values as it will have an empty map.
      CustomMapTransformer​(java.util.Map<java.lang.String,​java.lang.String> replacementVars)
      CustomMapTransformer that will replace any values in the map while processing.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String name()
      the name that will match the ${name:key} the transform is selected that matches the same name.
      GResultOf<java.lang.String> process​(java.lang.String path, java.lang.String key, java.lang.String rawValue)
      When a match is found for ${name:key} the key and the path are passed into the process method.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CustomMapTransformer

        public CustomMapTransformer()
        Default CustomMapTransformer that will not replace any values as it will have an empty map.
      • CustomMapTransformer

        public CustomMapTransformer​(java.util.Map<java.lang.String,​java.lang.String> replacementVars)
        CustomMapTransformer that will replace any values in the map while processing.
        Parameters:
        replacementVars - values to replace
    • Method Detail

      • name

        public java.lang.String name()
        Description copied from interface: Transformer
        the name that will match the ${name:key} the transform is selected that matches the same name.
        Specified by:
        name in interface Transformer
        Returns:
        the name of the transform
      • process

        public GResultOf<java.lang.String> process​(java.lang.String path,
                                                   java.lang.String key,
                                                   java.lang.String rawValue)
        Description copied from interface: Transformer
        When a match is found for ${name:key} the key and the path are passed into the process method. The returned value replaces the whole ${name:key}
        Specified by:
        process in interface Transformer
        Parameters:
        path - the current path
        key - the key to lookup int this transform.
        rawValue - the whole raw value of the current string to transform.
        Returns:
        the value to replace the ${name:key}