Enum CoercionFunction

    • Enum Constant Detail

      • 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 Detail

      • values

        public static CoercionFunction[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (CoercionFunction c : CoercionFunction.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static CoercionFunction valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type 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.