Enum PathType
- All Implemented Interfaces:
Serializable, Comparable<PathType>, java.lang.constant.Constable
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionPaths as JSONPath expressions.Paths as JSONPointer expressions.The legacy approach, loosely based on JSONPath (but not guaranteed to give valid JSONPath expressions).Paths as a URI reference. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BiFunction<String, Integer, String> private final BiFunction<String, String, String> static final PathTypeThe default path generation approach to use.private final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePathType(String rootToken, BiFunction<String, String, String> appendTokenFn, BiFunction<String, Integer, String> appendIndexFn) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionAppend the given index to the provided current path.Append the given child token to the provided current path.convertToJsonPointer(String path) (package private) static StringfromJsonPath(String str) (package private) static StringfromLegacy(String path) getRoot()Return the representation of the document root.(package private) static intparseQuote(StringBuilder sb, String s, int pos) Parses a single-quoted string.(package private) static intparseSelector(StringBuilder sb, String s, int pos) Parses a JSONPath selector(package private) static intparseShorthand(StringBuilder sb, String s, int pos) Parses a JSONPath shorthand selectorprivate static StringReplace common special characters that are to be considered for all types of paths.static PathTypeReturns the enum constant of this type with the specified name.static PathType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
LEGACY
The legacy approach, loosely based on JSONPath (but not guaranteed to give valid JSONPath expressions). -
JSON_PATH
Paths as JSONPath expressions. -
JSON_POINTER
Paths as JSONPointer expressions. -
URI_REFERENCE
Paths as a URI reference.
-
-
Field Details
-
DEFAULT
The default path generation approach to use. -
rootToken
-
appendTokenFn
-
appendIndexFn
-
-
Constructor Details
-
PathType
private PathType(String rootToken, BiFunction<String, String, String> appendTokenFn, BiFunction<String, Integer, String> appendIndexFn) Constructor.- Parameters:
rootToken- The token representing the document root.appendTokenFn- A function used to define the path fragment used to append a token (e.g. property) to an existing path.appendIndexFn- A function used to append an index (for arrays) to an existing path.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
replaceCommonSpecialCharactersIfPresent
-
append
-
append
-
getRoot
-
convertToJsonPointer
-
fromLegacy
-
fromJsonPath
-
parseShorthand
Parses a JSONPath shorthand selector- Parameters:
sb- receives the results- the source stringpos- the index into s immediately following the dot- Returns:
- the index following the selector name
-
parseSelector
Parses a JSONPath selector- Parameters:
sb- receives the results- the source stringpos- the index into s immediately following the open bracket- Returns:
- the index following the closing bracket
-
parseQuote
Parses a single-quoted string.- Parameters:
sb- receives the results- the source stringpos- the index into s immediately following the open quote- Returns:
- the index following the closing quote
-