public final class JsonValues extends Object
JsonValue
.Modifier and Type | Method and Description |
---|---|
static Class<?> |
asClass(org.forgerock.json.JsonValue value)
Returns the class object associated with a named class or interface, using the thread
context class loader.
|
static <T> T |
asNewInstance(org.forgerock.json.JsonValue value,
Class<T> type)
Creates a new instance of a named class.
|
static org.forgerock.util.Function<org.forgerock.json.JsonValue,Bindings,org.forgerock.json.JsonValueException> |
bindings()
Returns a function that will create some bindings based of a Map-based
JsonValue . |
static org.forgerock.util.Function<org.forgerock.json.JsonValue,Bindings,org.forgerock.json.JsonValueException> |
bindings(Bindings bindings)
Returns a function that will create some bindings based of a Map-based
JsonValue . |
static org.forgerock.util.Function<org.forgerock.json.JsonValue,org.forgerock.json.JsonValue,org.forgerock.json.JsonValueException> |
evaluated()
Returns a function that will evaluate all String nodes.
|
static org.forgerock.util.Function<org.forgerock.json.JsonValue,org.forgerock.json.JsonValue,org.forgerock.json.JsonValueException> |
evaluated(Bindings bindings)
Returns a function that will evaluate all String nodes.
|
static <T> org.forgerock.util.Function<org.forgerock.json.JsonValue,Expression<T>,org.forgerock.json.JsonValueException> |
expression(Class<T> type)
Returns a function for transforming JsonValues to expressions.
|
static <T> org.forgerock.util.Function<org.forgerock.json.JsonValue,Expression<T>,org.forgerock.json.JsonValueException> |
expression(Class<T> type,
Bindings bindings)
Returns a function for transforming JsonValues to expressions.
|
static org.forgerock.json.JsonValue |
firstOf(org.forgerock.json.JsonValue config,
String... names)
Returns, if the given JSON value contains one of the names, the first
defined JSON value, otherwise if the given JSON value does not match any
of the names, then a JsonValue encapsulating null is returned.
|
static org.forgerock.json.JsonValue |
getWithDeprecation(org.forgerock.json.JsonValue config,
org.slf4j.Logger logger,
String name,
String... deprecatedNames)
Returns the named property from the provided JSON object, falling back to
zero or more deprecated property names.
|
static org.forgerock.util.Function<org.forgerock.json.JsonValue,String,org.forgerock.json.JsonValueException> |
heapObjectNameOrPointer()
Returns a function that will look for the name of the object.
|
static <T> org.forgerock.util.Function<org.forgerock.json.JsonValue,LeftValueExpression<T>,org.forgerock.json.JsonValueException> |
leftValueExpression(Class<T> type)
Returns a function for transforming JsonValues to left-value expressions.
|
static <T> org.forgerock.util.Function<org.forgerock.json.JsonValue,T,HeapException> |
optionalHeapObject(Heap heap,
Class<T> type)
Returns a
Function to transform a list of String-based JsonValue s into a list of optional heap
objects. |
static org.forgerock.json.JsonValue |
readJson(URL resource)
Builds a
JsonValue from the given URL. |
static <T> org.forgerock.util.Function<org.forgerock.json.JsonValue,T,HeapException> |
requiredHeapObject(Heap heap,
Class<T> type)
Returns a
Function to transform a list of String-based JsonValue s into a list of required heap
objects. |
static org.forgerock.util.Function<org.forgerock.json.JsonValue,org.forgerock.json.JsonValue,org.forgerock.json.JsonValueException> |
resolvedLocation()
Returns a function that will resolve the field $location.
|
static org.forgerock.util.Function<org.forgerock.json.JsonValue,org.forgerock.json.JsonValue,org.forgerock.json.JsonValueException> |
resolvedLocation(Bindings bindings)
Returns a function that will resolve the field $location.
|
static org.forgerock.util.Function<org.forgerock.json.JsonValue,org.forgerock.json.JsonValue,org.forgerock.json.JsonValueException> |
slashEnded()
Returns the JsonValue with its value ended by a slash.
|
static void |
warnForDeprecation(org.forgerock.json.JsonValue config,
org.slf4j.Logger logger,
String name,
String deprecatedName)
Issues a warning that the configuration property
oldName is
deprecated and that the property newName should be used instead. |
public static org.forgerock.util.Function<org.forgerock.json.JsonValue,org.forgerock.json.JsonValue,org.forgerock.json.JsonValueException> slashEnded()
config.get("openamUri").as(evaluatedWithHeapProperties())
.required()
.as(slashEnded())
.as(uri());
org.forgerock.json.JsonValueException
- If the JSON value is not a string.public static Class<?> asClass(org.forgerock.json.JsonValue value)
null
, this method returns null
.value
- the value containing the class name string.org.forgerock.json.JsonValueException
- if value is not a string or the named class could not be found.public static <T> T asNewInstance(org.forgerock.json.JsonValue value, Class<T> type)
new
expression with an empty argument list. The class is initialized if it has
not already been initialized. If the value is null
, this method returns
null
.T
- the type of the new instance.value
- the value containing the class name string.type
- the type that the instantiated class should to resolve to.org.forgerock.json.JsonValueException
- if the requested class could not be instantiated.public static org.forgerock.util.Function<org.forgerock.json.JsonValue,org.forgerock.json.JsonValue,org.forgerock.json.JsonValueException> resolvedLocation()
ResolveLocationJsonValueFunction
public static org.forgerock.util.Function<org.forgerock.json.JsonValue,org.forgerock.json.JsonValue,org.forgerock.json.JsonValueException> resolvedLocation(Bindings bindings)
bindings
- The bindings used when evaluating the $location valueResolveLocationJsonValueFunction
public static org.forgerock.util.Function<org.forgerock.json.JsonValue,String,org.forgerock.json.JsonValueException> heapObjectNameOrPointer()
The following declaration would return Inline:
{
"name": "Inline",
"type": "Router"
}
And this one would return {WelcomeHandler}/heap/objects/0/config/defaultHandler:
{
"type": "WelcomeHandler"
}
public static org.forgerock.util.Function<org.forgerock.json.JsonValue,org.forgerock.json.JsonValue,org.forgerock.json.JsonValueException> evaluated()
Malformed expressions are ignored e.g: "$$$${{" and their values are not changed.
When an error occurs during the
evaluation of an expression, the value is set to null
because we
cannot differentiate successful evaluations or failed ones.
JsonValue
public static org.forgerock.util.Function<org.forgerock.json.JsonValue,org.forgerock.json.JsonValue,org.forgerock.json.JsonValueException> evaluated(Bindings bindings)
Malformed expressions are ignored e.g: "$$$${{" and their values are not changed.
When an error occurs during the
evaluation of an expression, the value is set to null
because we
cannot differentiate successful evaluations or failed ones.
bindings
- the bindings to use when evaluating the found expressionsJsonValue
public static org.forgerock.json.JsonValue firstOf(org.forgerock.json.JsonValue config, String... names)
Uri uri = firstOf(config, "authorizeEndpoint", "authorize_endpoint").required().asURI();
config
- The JSON value where one of the selected names can be found.
Usually in a heaplet configuration for example.names
- Names of the attributes that you are looking for.public static <T> org.forgerock.util.Function<org.forgerock.json.JsonValue,LeftValueExpression<T>,org.forgerock.json.JsonValueException> leftValueExpression(Class<T> type)
T
- expected result typetype
- The expected result type of the expression.public static <T> org.forgerock.util.Function<org.forgerock.json.JsonValue,Expression<T>,org.forgerock.json.JsonValueException> expression(Class<T> type)
T
- expected result typetype
- The expected result type of the expression.public static <T> org.forgerock.util.Function<org.forgerock.json.JsonValue,Expression<T>,org.forgerock.json.JsonValueException> expression(Class<T> type, Bindings bindings)
T
- expected result typetype
- The expected result type of the expression.bindings
- The initial bindings used when evaluated this expressionpublic static org.forgerock.util.Function<org.forgerock.json.JsonValue,Bindings,org.forgerock.json.JsonValueException> bindings()
JsonValue
.JsonValue
.public static org.forgerock.util.Function<org.forgerock.json.JsonValue,Bindings,org.forgerock.json.JsonValueException> bindings(Bindings bindings)
JsonValue
.bindings
- The initial bindings used when evaluated theJsonValue
.public static <T> org.forgerock.util.Function<org.forgerock.json.JsonValue,T,HeapException> requiredHeapObject(Heap heap, Class<T> type)
Function
to transform a list of String-based JsonValue
s into a list of required heap
objects.T
- expected object typeheap
- the heap to query for references resolutiontype
- expected object typeFunction
to transform a list of String-based JsonValue
s into a list of required heap
objects.public static <T> org.forgerock.util.Function<org.forgerock.json.JsonValue,T,HeapException> optionalHeapObject(Heap heap, Class<T> type)
Function
to transform a list of String-based JsonValue
s into a list of optional heap
objects.T
- expected object typeheap
- the heap to query for references resolutiontype
- expected object typeFunction
to transform a list of String-based JsonValue
s into a list of required heap
objects.public static org.forgerock.json.JsonValue getWithDeprecation(org.forgerock.json.JsonValue config, org.slf4j.Logger logger, String name, String... deprecatedNames)
config
- The configuration object.logger
- The logger which should be used for deprecation warnings.name
- The non-deprecated property name.deprecatedNames
- The deprecated property names ordered from newest to oldest.public static void warnForDeprecation(org.forgerock.json.JsonValue config, org.slf4j.Logger logger, String name, String deprecatedName)
oldName
is
deprecated and that the property newName
should be used instead.config
- The configuration object.logger
- The logger which should be used for deprecation warnings.name
- The non-deprecated property name.deprecatedName
- The deprecated property name.public static org.forgerock.json.JsonValue readJson(URL resource) throws IOException
JsonValue
from the given URL.resource
- the URL to read the JSON fromJsonValue
built from the resource URLIOException
- If an error occurs while trying to read the JSONCopyright © 2025 Open Identity Platform Community. All rights reserved.