|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectargo.jdom.JsonNodeSelector<T,U>
T - The type of Object worked on.U - The type of Object returned.public final class JsonNodeSelector<T,U>
Instances of JsonNodeSelector extract values from Objects of a specified type.
For example, given a JsonNode representing {"Fee":{"fi":"fo"}},
anObjectNodeWithField("Fee")
.withChild(anObjectNodeWithField("fi"))
.withChild(aStringNode())
.getValue(jsonNode)
will return the String "fo".
| Method Summary | ||
|---|---|---|
U |
getValue(T argument)
Extracts a value from the give JsonNode. |
|
boolean |
matches(T jsonNode)
Determines whether this JsonNodeSelector can extract a value from the given JsonNode. |
|
java.lang.String |
toString()
|
|
|
with(JsonNodeSelector<U,V> childJsonNodeSelector)
Constructs a JsonNodeSelector consisting of this chained with the given JsonNodeSelector. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public boolean matches(T jsonNode)
JsonNodeSelector can extract a value from the given JsonNode.
jsonNode - the JsonNode to test.
JsonNode, false otherwise.public U getValue(T argument)
JsonNode.
argument - the JsonNode to extract a value from.
java.lang.IllegalArgumentException - if calling matches{@code with the given {@code JsonNode} would return false, indicating no value can be extracted from it.public <V> JsonNodeSelector<T,V> with(JsonNodeSelector<U,V> childJsonNodeSelector)
Constructs a JsonNodeSelector consisting of this chained with the given JsonNodeSelector.
For example, if we have JsonNodeSelectors for the first element of an array, and another that
selects the second element of an array, and we chain them together in that order, we will get a selector that
works on nested arrays, selecting the second element from an array stored in the first element of a parent
array.
V - the type the chained JsonNodeSelector will return.childJsonNodeSelector - the JsonNodeSelector to chain onto this.
JsonNodeSelector representing this, and the given selector applied in sequence.public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||