Package com.networknt.schema
Enum PathType
- java.lang.Object
-
- java.lang.Enum<PathType>
-
- com.networknt.schema.PathType
-
- All Implemented Interfaces:
Serializable,Comparable<PathType>
public enum PathType extends Enum<PathType>
Enumeration defining the different approached available to generate the paths added to validation messages.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description JSON_PATHPaths as JSONPath expressions.JSON_POINTERPaths as JSONPointer expressions.LEGACYThe legacy approach, loosely based on JSONPath (but not guaranteed to give valid JSONPath expressions).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringappend(String currentPath, int index)Append the given index to the provided current path.Stringappend(String currentPath, String child)Append the given child token to the provided current path.StringconvertToJsonPointer(String path)StringgetRoot()Return the representation of the document root.static PathTypevalueOf(String name)Returns 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 Detail
-
LEGACY
public static final PathType LEGACY
The legacy approach, loosely based on JSONPath (but not guaranteed to give valid JSONPath expressions).
-
JSON_PATH
public static final PathType JSON_PATH
Paths as JSONPath expressions.
-
JSON_POINTER
public static final PathType JSON_POINTER
Paths as JSONPointer expressions.
-
-
Field Detail
-
DEFAULT
public static final PathType DEFAULT
The default path generation approach to use.
-
-
Method Detail
-
values
public static PathType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (PathType c : PathType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static PathType 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 nameNullPointerException- if the argument is null
-
append
public String append(String currentPath, String child)
Append the given child token to the provided current path.- Parameters:
currentPath- The path to append to.child- The child token.- Returns:
- The resulting complete path.
-
append
public String append(String currentPath, int index)
Append the given index to the provided current path.- Parameters:
currentPath- The path to append to.index- The index to append.- Returns:
- The resulting complete path.
-
getRoot
public String getRoot()
Return the representation of the document root.- Returns:
- The root token.
-
-