Enum Option

java.lang.Object
java.lang.Enum<Option>
com.jayway.jsonpath.Option
All Implemented Interfaces:
Serializable, Comparable<Option>, java.lang.constant.Constable

public enum Option extends Enum<Option>
  • Enum Constant Details

    • DEFAULT_PATH_LEAF_TO_NULL

      public static final Option DEFAULT_PATH_LEAF_TO_NULL
      returns null for missing leaf.
       [
            {
               "foo" : "foo1",
               "bar" : "bar1"
            }
            {
               "foo" : "foo2"
            }
       ]
      
      the path : "$[*].bar" Without flag ["bar1"] is returned With flag ["bar1", null] is returned
    • ALWAYS_RETURN_LIST

      public static final Option ALWAYS_RETURN_LIST
      Makes this implementation more compliant to the Goessner spec. All results are returned as Lists.
    • AS_PATH_LIST

      public static final Option AS_PATH_LIST
      Returns a list of path strings representing the path of the evaluation hits
    • SUPPRESS_EXCEPTIONS

      public static final Option SUPPRESS_EXCEPTIONS
      Suppress all exceptions when evaluating path.
      If an exception is thrown and the option ALWAYS_RETURN_LIST an empty list is returned. If an exception is thrown and the option ALWAYS_RETURN_LIST is not present null is returned.
    • REQUIRE_PROPERTIES

      public static final Option REQUIRE_PROPERTIES
      Configures JsonPath to require properties defined in path when an indefinite path is evaluated. Given:
       [
           {
               "a" : "a-val",
               "b" : "b-val"
           },
           {
               "a" : "a-val",
           }
       ]
       
      evaluating the path "$[*].b" If REQUIRE_PROPERTIES option is present PathNotFoundException is thrown. If REQUIRE_PROPERTIES option is not present ["b-val"] is returned.
  • Constructor Details

    • Option

      private Option()
  • Method Details

    • values

      public static Option[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Option 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