Package org.forgerock.config.util
Enum Class CoercionFunction
- All Implemented Interfaces:
Serializable
,Comparable<CoercionFunction>
,java.lang.constant.Constable
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 ConstantDescriptionA 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 stringifiedBoolean
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 stringifiedInteger
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 stringifiedNumber
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 TypeMethodDescriptionClass<?>
getType()
Get the type of the coercion function.key()
Get the key of the coercion function.static CoercionFunction
Returns the enum constant of this class with the specified name.static CoercionFunction[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
BOOL
A coercion function that processes a stringifiedBoolean
into a boolean. For example, this format{ "enabled" : { "$bool" : "true" } }
would be converted into this{ "enabled" : true }
-
INT
A coercion function that processes a stringifiedInteger
into an int. For example, this format{ "port" : { "$int" : "80" } }
would be converted into this{ "port" : 80 }
-
NUMBER
A coercion function that processes a stringifiedNumber
into a double. For example, this format{ "size" : { "$number" : "80.0" } }
would be converted into this{ "size" : 80.0 }
-
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
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
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
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
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
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
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
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
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 nameNullPointerException
- if the argument is null
-
key
Get the key of the coercion function.- Returns:
- the key of the coercion function.
-
getType
Get the type of the coercion function.- Returns:
- the Java type that this coercion function will return.
-