Class JSONFormattedControlDecodeBehavior
- java.lang.Object
-
- com.unboundid.ldap.sdk.unboundidds.controls.JSONFormattedControlDecodeBehavior
-
- All Implemented Interfaces:
java.io.Serializable
@Mutable @ThreadSafety(level=NOT_THREADSAFE) public final class JSONFormattedControlDecodeBehavior extends java.lang.Object implements java.io.Serializable
This enum defines options for the behaviors that should be used when trying to decode JSON objects embedded in aJSONFormattedRequestControl
orJSONFormattedResponseControl
asControl
objects.
NOTE: This class, and other classes within the
com.unboundid.ldap.sdk.unboundidds
package structure, are only supported for use against Ping Identity, UnboundID, and Nokia/Alcatel-Lucent 8661 server products. These classes provide support for proprietary functionality or for external specifications that are not considered stable or mature enough to be guaranteed to work in an interoperable way with other types of LDAP servers.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JSONFormattedControlDecodeBehavior()
Creates a new instance of this behavior with the default configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allowEmbeddedJSONFormattedControl()
Indicates whether to allow a JSON-formatted request or response control to include another JSON-formatted request or response control in the set of embedded controls.void
setAllowEmbeddedJSONFormattedControl(boolean allowEmbeddedJSONFormattedControl)
Specifies whether to allow a JSON-formatted request or response control to include another JSON-formatted request or response control in the set of embedded controls.void
setStrict(boolean strict)
Specifies whether to use strict mode when parsing JSON objects as controls.void
setThrowOnInvalidCriticalControl(boolean throwOnInvalidCriticalControl)
Specifies whether to throw an exception if the JSON-formatted request or response control includes a JSON object that at least meets the basic requirements for a JSON-formatted control with a criticality oftrue
, but that cannot be parsed as a validControl
instance for some reason.void
setThrowOnInvalidNonCriticalControl(boolean throwOnInvalidNonCriticalControl)
Specifies whether to throw an exception if the JSON-formatted request or response control includes a JSON object that at least meets the basic requirements for a JSON-formatted control with a criticality offalse
, but that cannot be parsed as a validControl
instance for some reason.void
setThrowOnUnparsableObject(boolean throwOnUnparsableObject)
Specifies whether to throw an exception if the JSON-formatted request or response control includes a JSON object that does not meet the basic requirements for representing a valid JSON-formatted control, including controls without the requiredoid
andcriticality
fields, and controls with bothvalue-base64
andvalue-json
fields.boolean
strict()
Indicates whether to use strict mode when parsing JSON objects as controls.boolean
throwOnInvalidCriticalControl()
Indicates whether to throw an exception if the JSON-formatted request or response control includes a JSON object that at least meets the basic requirements for a JSON-formatted control with a criticality oftrue
, but that cannot be parsed as a validControl
instance for some reason.boolean
throwOnInvalidNonCriticalControl()
Indicates whether to throw an exception if the JSON-formatted request or response control includes a JSON object that at least meets the basic requirements for a JSON-formatted control with a criticality offalse
, but that cannot be parsed as a validControl
instance for some reason.boolean
throwOnUnparsableObject()
Indicates whether to throw an exception if the JSON-formatted request or response control includes a JSON object that does not meet the basic requirements for representing a valid JSON-formatted control, including controls without the requiredoid
andcriticality
fields, and controls with bothvalue-base64
andvalue-json
fields.java.lang.String
toString()
Retrieves a string representation of this JSON-formatted control decode behavior.void
toString(java.lang.StringBuilder buffer)
Appends a string representation of this JSON-formatted control decode behavior to the provided buffer.
-
-
-
Constructor Detail
-
JSONFormattedControlDecodeBehavior
public JSONFormattedControlDecodeBehavior()
Creates a new instance of this behavior with the default configuration. The default configuration is as follows:throwOnUnparsableObject
is set totrue
throwOnInvalidCriticalControl
is set totrue
throwOnInvalidNonCriticalControl
is set totrue
allowEmbeddedJSONFormattedControl
is set tofalse
strict
is set tofalse
-
-
Method Detail
-
throwOnUnparsableObject
public boolean throwOnUnparsableObject()
Indicates whether to throw an exception if the JSON-formatted request or response control includes a JSON object that does not meet the basic requirements for representing a valid JSON-formatted control, including controls without the requiredoid
andcriticality
fields, and controls with bothvalue-base64
andvalue-json
fields. If strict mode is enabled, then this also includes unrecognized top-level fields.- Returns:
true
if an exception should be thrown if a JSON-formatted request or response control includes a JSON object that does not meet the basic requirements for representing a valid JSON-formatted control, orfalse
if any such JSON objects should simply be ignored.
-
setThrowOnUnparsableObject
public void setThrowOnUnparsableObject(boolean throwOnUnparsableObject)
Specifies whether to throw an exception if the JSON-formatted request or response control includes a JSON object that does not meet the basic requirements for representing a valid JSON-formatted control, including controls without the requiredoid
andcriticality
fields, and controls with bothvalue-base64
andvalue-json
fields. If strict mode is enabled, then this also includes unrecognized top-level fields.- Parameters:
throwOnUnparsableObject
- Indicates whether to throw an exception for any JSON object that does not meet the basic requirements for a JSON-formatted control. If this istrue
, then an exception will be thrown if any such JSON object is encountered. If this isfalse
, any such JSON objects will be ignored.
-
throwOnInvalidCriticalControl
public boolean throwOnInvalidCriticalControl()
Indicates whether to throw an exception if the JSON-formatted request or response control includes a JSON object that at least meets the basic requirements for a JSON-formatted control with a criticality oftrue
, but that cannot be parsed as a validControl
instance for some reason. This may include a control with an OID for which specific decoding support has been implemented but a problem is encountered while trying to decode the JSON object as a control of that type, or a control with an OID for which no specific decoding has been implemented but includes a value specified using thevalue-json
format.- Returns:
true
if an exception should be thrown if a critical control cannot be decoded as a valid control instance, orfalse
if any such controls should be ignored.
-
setThrowOnInvalidCriticalControl
public void setThrowOnInvalidCriticalControl(boolean throwOnInvalidCriticalControl)
Specifies whether to throw an exception if the JSON-formatted request or response control includes a JSON object that at least meets the basic requirements for a JSON-formatted control with a criticality oftrue
, but that cannot be parsed as a validControl
instance for some reason. This may include a control with an OID for which specific decoding support has been implemented but a problem is encountered while trying to decode the JSON object as a control of that type, or a control with an OID for which no specific decoding has been implemented but includes a value specified using thevalue-json
format.- Parameters:
throwOnInvalidCriticalControl
- Indicates whether to throw an exception for any well-formed JSON object with a criticality oftrue
that cannot be parsed as aControl
. If this istrue
, then an exception will be thrown if any such object is encountered. If this isfalse
, then any such JSON objects will be ignored.
-
throwOnInvalidNonCriticalControl
public boolean throwOnInvalidNonCriticalControl()
Indicates whether to throw an exception if the JSON-formatted request or response control includes a JSON object that at least meets the basic requirements for a JSON-formatted control with a criticality offalse
, but that cannot be parsed as a validControl
instance for some reason. This may include a control with an OID for which specific decoding support has been implemented but a problem is encountered while trying to decode the JSON object as a control of that type, or a control with an OID for which no specific decoding has been implemented but includes a value specified using thevalue-json
format.- Returns:
true
if an exception should be thrown if a non-critical control cannot be decoded as a valid control instance, orfalse
if any such controls should be ignored.
-
setThrowOnInvalidNonCriticalControl
public void setThrowOnInvalidNonCriticalControl(boolean throwOnInvalidNonCriticalControl)
Specifies whether to throw an exception if the JSON-formatted request or response control includes a JSON object that at least meets the basic requirements for a JSON-formatted control with a criticality offalse
, but that cannot be parsed as a validControl
instance for some reason. This may include a control with an OID for which specific decoding support has been implemented but a problem is encountered while trying to decode the JSON object as a control of that type, or a control with an OID for which no specific decoding has been implemented but includes a value specified using thevalue-json
format.- Parameters:
throwOnInvalidNonCriticalControl
- Indicates whether to throw an exception for any well-formed JSON object with a criticality offalse
that cannot be parsed as aControl
. If this istrue
, then an exception will be thrown if any such object is encountered. If this isfalse
, then any such JSON objects will be ignored.
-
allowEmbeddedJSONFormattedControl
public boolean allowEmbeddedJSONFormattedControl()
Indicates whether to allow a JSON-formatted request or response control to include another JSON-formatted request or response control in the set of embedded controls. If embedded JSON-formatted controls are not allowed, then the attempt to decode will throw an exception if the control is critical, or it will be ignored with a non-fatal error message if the control is non-critical.- Returns:
true
if embedded JSON-formatted request or response controls should be allowed, orfalse
if not.
-
setAllowEmbeddedJSONFormattedControl
public void setAllowEmbeddedJSONFormattedControl(boolean allowEmbeddedJSONFormattedControl)
Specifies whether to allow a JSON-formatted request or response control to include another JSON-formatted request or response control in the set of embedded controls. If embedded JSON-formatted controls are not allowed, then the attempt to decode will throw an exception if the control is critical, or it will be ignored with a non-fatal error message if the control is non-critical.- Parameters:
allowEmbeddedJSONFormattedControl
- Indicates whether to allow a JSON-formatted request or response control. If this istrue
, then an embedded JSON-formatted control will either result in an exception (if the embedded control is critical) or cause it to be ignored with a non-fatal error message (if it is not critical). If this isfalse
, then the JSON-formatted control will be included directly in the list of decoded controls that is returned without attempting to extract its embedded controls.
-
strict
public boolean strict()
Indicates whether to use strict mode when parsing JSON objects as controls. This may include throwing an exception if a JSON object contains any unrecognized fields, or if the object violates any other control-specific constraints.- Returns:
true
if strict mode should be used when parsing JSON objects as controls, orfalse
if a lenient mode should be used.
-
setStrict
public void setStrict(boolean strict)
Specifies whether to use strict mode when parsing JSON objects as controls. This may include throwing an exception if a JSON object contains any unrecognized fields, or if the object violates any other control-specific constraints.- Parameters:
strict
- Indicates whether to use strict mode when parsing JSON objects as controls. If this istrue
, then strict mode will be used. If this isfalse
, then a more lenient mode will be used.
-
toString
@NotNull public java.lang.String toString()
Retrieves a string representation of this JSON-formatted control decode behavior.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of this JSON-formatted control decode behavior.
-
-