Class 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 a JSONFormattedRequestControl or JSONFormattedResponseControl as Control 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
    • 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 of true, but that cannot be parsed as a valid Control 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 of false, but that cannot be parsed as a valid Control 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 required oid and criticality fields, and controls with both value-base64 and value-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 of true, but that cannot be parsed as a valid Control 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 of false, but that cannot be parsed as a valid Control 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 required oid and criticality fields, and controls with both value-base64 and value-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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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 to true
        • throwOnInvalidCriticalControl is set to true
        • throwOnInvalidNonCriticalControl is set to true
        • allowEmbeddedJSONFormattedControl is set to false
        • strict is set to false
    • 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 required oid and criticality fields, and controls with both value-base64 and value-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, or false 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 required oid and criticality fields, and controls with both value-base64 and value-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 is true, then an exception will be thrown if any such JSON object is encountered. If this is false, 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 of true, but that cannot be parsed as a valid Control 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 the value-json format.
        Returns:
        true if an exception should be thrown if a critical control cannot be decoded as a valid control instance, or false 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 of true, but that cannot be parsed as a valid Control 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 the value-json format.
        Parameters:
        throwOnInvalidCriticalControl - Indicates whether to throw an exception for any well-formed JSON object with a criticality of true that cannot be parsed as a Control. If this is true, then an exception will be thrown if any such object is encountered. If this is false, 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 of false, but that cannot be parsed as a valid Control 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 the value-json format.
        Returns:
        true if an exception should be thrown if a non-critical control cannot be decoded as a valid control instance, or false 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 of false, but that cannot be parsed as a valid Control 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 the value-json format.
        Parameters:
        throwOnInvalidNonCriticalControl - Indicates whether to throw an exception for any well-formed JSON object with a criticality of false that cannot be parsed as a Control. If this is true, then an exception will be thrown if any such object is encountered. If this is false, 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, or false 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 is true, 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 is false, 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, or false 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 is true, then strict mode will be used. If this is false, 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 class java.lang.Object
        Returns:
        A string representation of this JSON-formatted control decode behavior.
      • toString

        public void toString​(@NotNull
                             java.lang.StringBuilder buffer)
        Appends a string representation of this JSON-formatted control decode behavior to the provided buffer.
        Parameters:
        buffer - The buffer to which the string representation should be appended.