Package sk.antons.json.find
Class PathFinder
java.lang.Object
sk.antons.json.find.PathFinder
Helper class for find by path functionality
- Author:
- antons
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionall()Find all json values with defined pathFind all json values with defined path and converts them to string valuefirst()Find first json value with defined pathFind first json value with defined path and converts it to string valuestatic PathFinderNew instance of PathFinderstatic PathFinderof(JsonValue root, PathMatcher matcher) New instance of PathFinderoptional()Just helper class for creating Optional from first()Juste helper method for converting firstLiteral() to Optional.stream()Juste helper methods which converts all() to stream.Just helper method, which converts allLiterals() to strem.
-
Constructor Details
-
PathFinder
New instance or finder- Parameters:
root- root json nodematcher- path matcher for find functionality
-
-
Method Details
-
of
New instance of PathFinder- Parameters:
root- root json node.matcher- path matcher for find- Returns:
- new instance
-
of
New instance of PathFinder- Parameters:
root- root json node.path- path for simple path matcher- Returns:
- new instance
-
all
Find all json values with defined path- Returns:
- all json values defined by path matcher
-
stream
Juste helper methods which converts all() to stream.- Returns:
- stream from all() list
-
first
Find first json value with defined path- Returns:
- first json value defined by path matcher
-
optional
Just helper class for creating Optional from first()- Returns:
- optional from first()
-
allLiterals
Find all json values with defined path and converts them to string value- Returns:
- all json value defined by path matcher converted to string
-
streamLiterals
Just helper method, which converts allLiterals() to strem.- Returns:
- stream from allLiterals() list
-
firstLiteral
Find first json value with defined path and converts it to string value- Returns:
- first json value defined by path matcher converted to string
-
optionalLiteral
Juste helper method for converting firstLiteral() to Optional.- Returns:
- optional from firstLiteral()
-