Package org.eclipse.ditto.json
Interface JsonFieldSelector
- All Superinterfaces:
Iterable<JsonPointer>
A
JsonFieldSelector
is basically a set of JsonPointer
s. While a pointer refers to a single value, a
field selector points to multiple values at once. It can be used to compose a new JSON object from an existing JSON
object; thereby the field selector defines the set of fields of the new JSON object. This comes in handy when
applying REST field selectors or even addressing a REST sub resource.
Implementations of this interface are required to be immutable!
-
Method Summary
Modifier and TypeMethodDescriptionReturns theJsonPointer
s on which this field selector is based.int
getSize()
Returns the size of this JSON field selector, i.boolean
isEmpty()
Indicates whether this field selector is empty.static JsonFieldSelector
newInstance
(CharSequence pointerString, CharSequence... furtherPointerStrings) Returns a new JSON field selector which is based on the givenJsonPointer
(s).toString()
This method has two possible outcomes: If the original field selector string is available it will be simply returned. Otherwise a typical string representation of this object is returned.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
newInstance
static JsonFieldSelector newInstance(CharSequence pointerString, CharSequence... furtherPointerStrings) Returns a new JSON field selector which is based on the givenJsonPointer
(s).- Parameters:
pointerString
- representation of a JSON pointer of the field selector to be created.furtherPointerStrings
- additional representations of JSON pointers to form the field selector to be created by this method.- Returns:
- a new JSON field selector.
- Throws:
NullPointerException
- if any argument isnull
.
-
getPointers
Set<JsonPointer> getPointers()Returns theJsonPointer
s on which this field selector is based.- Returns:
- an unmodifiable set of JSON pointers this field selector contains.
-
getSize
int getSize()Returns the size of this JSON field selector, i. e. the amount of JSON pointers it contains.- Returns:
- the size of this JSON field selector.
-
isEmpty
boolean isEmpty()Indicates whether this field selector is empty.- Returns:
true
if this field selector does not contain any JSON pointers,false
else.
-
toString
String toString()This method has two possible outcomes:- If the original field selector string is available it will be simply returned.
- Otherwise a typical string representation of this object is returned.
-