Enum Class CoercionFunction

java.lang.Object
java.lang.Enum<CoercionFunction>
org.forgerock.config.util.CoercionFunction
All Implemented Interfaces:
Serializable, Comparable<CoercionFunction>, java.lang.constant.Constable

public enum CoercionFunction extends Enum<CoercionFunction>
Coercions that can be applied to a given json value.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    A coercion function that processes a stringified json array into a json array.
    A coercion function that decodes a base64-encoded string into a decoded string.
    A coercion function that encodes a string into a base64-encoded String.
    A coercion function that processes a stringified Boolean into a boolean.
    A coercion function that inlines the content of another file that may be a relative path to a current location.
    A coercion function that processes a stringified Integer into an int.
    A coercion function that processes a list of strings delimited by a "," into a json array.
    A coercion function that processes a stringified Number into a double.
    A coercion function that processes a stringified json object into a json object.
    A coercion function that does a no-op transformation of a String.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the type of the coercion function.
    key()
    Get the key of the coercion function.
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • BOOL

      public static final CoercionFunction BOOL
      A coercion function that processes a stringified Boolean into a boolean. For example, this format
           {
               "enabled" : {
                    "$bool" : "true"
               }
           }
       
      would be converted into this
           {
               "enabled" : true
           }
       
    • INT

      public static final CoercionFunction INT
      A coercion function that processes a stringified Integer into an int. For example, this format
           {
               "port" : {
                    "$int" : "80"
               }
           }
       
      would be converted into this
           {
               "port" : 80
           }
       
    • NUMBER

      public static final CoercionFunction NUMBER
      A coercion function that processes a stringified Number into a double. For example, this format
           {
               "size" : {
                    "$number" : "80.0"
               }
           }
       
      would be converted into this
           {
               "size" : 80.0
           }
       
    • ARRAY

      public static final CoercionFunction ARRAY
      A coercion function that processes a stringified json array into a json array. For example, this format
           {
               "properties" : {
                    "$array" : "[\"prop1\", \"prop2\"]"
               }
           }
       
      would be converted into this
           {
               "properties" : ["prop1", "prop2"]
           }
       
    • OBJECT

      public static final CoercionFunction OBJECT
      A coercion function that processes a stringified json object into a json object. For example, this format
           {
               "properties" : {
                    "$object" : "{\"my.property\" : \"my.value\"}"
               }
           }
       
      would be converted into this
           {
               "properties" : {
                   "my.property" : "my.value"
               }
           }
       
    • LIST

      public static final CoercionFunction LIST
      A coercion function that processes a list of strings delimited by a "," into a json array. For example, this format
           {
               "properties" : {
                    "$list" : "prop1,prop2"
               }
           }
       
      would be converted into this
           {
               "properties" : ["prop1", "prop2"]
           }
       
    • BASE64_ENCODE

      public static final CoercionFunction BASE64_ENCODE
      A coercion function that encodes a string into a base64-encoded String. For example, this format
           {
               "attribute" : {
                    "$base64:encode" : "Hello"
               }
           }
       
      would be converted into this
           {
               "attribute" : "SGVsbG8="
           }
       
    • BASE64_DECODE

      public static final CoercionFunction BASE64_DECODE
      A coercion function that decodes a base64-encoded string into a decoded string. For example, this format
           {
               "attribute" : {
                    "$base64:decode" : "SGVsbG8="
               }
           }
       
      would be converted into this
           {
               "attribute" : "Hello"
           }
       
    • STRING

      public static final CoercionFunction STRING
      A coercion function that does a no-op transformation of a String. For example, this format
           {
               "attribute" : {
                    "$string" : "Hello"
               }
           }
       
      would be converted into this
           {
               "attribute" : "Hello"
           }
       
    • INLINE

      public static final CoercionFunction INLINE
      A coercion function that inlines the content of another file that may be a relative path to a current location.

      For example, given this content at /tmp/mycontent:

       Content that is too large to be
       written directly into a JSON file.
       e.g. email template
       
      The this format:
           {
               "attribute" : {
                    "$inline" : "/tmp/mycontent"
               }
           }
       
      would be converted into this
           {
               "attribute" : "Content that is too large to be\nwritten directly into a JSON file\ne.g. email template"
           }
       
  • Method Details

    • values

      public static CoercionFunction[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CoercionFunction valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • key

      public String key()
      Get the key of the coercion function.
      Returns:
      the key of the coercion function.
    • getType

      public Class<?> getType()
      Get the type of the coercion function.
      Returns:
      the Java type that this coercion function will return.