Package org.eclipse.ditto.json
Interface JsonFieldSelectorBuilder
- All Superinterfaces:
Iterable<JsonPointer>
A mutable builder with a fluent API for a
JsonFieldSelector
. Implementations of this interface are normally
not thread safe and not reusable.-
Method Summary
Modifier and TypeMethodDescriptionaddFieldDefinition
(JsonFieldDefinition<?> fieldDefinition, JsonFieldDefinition<?>... furtherFieldDefinitions) Adds the JSON pointer of each givenJsonFieldDefinition
to the field selector to be built.addFieldDefinitions
(Iterable<JsonFieldDefinition<?>> fieldDefinitions) Adds the JSON pointer of each givenJsonFieldDefinition
s to the field selector to be built.addFieldSelector
(JsonFieldSelector fieldSelector) Adds the Json Pointers from the givenJsonFieldSelector
s to the field selector to be built.addFieldSelectorString
(String fieldSelectorString) Adds the JSON pointers contained in the new JSON field selector retrieved by parsing the given string.addFieldSelectorString
(String fieldSelectorString, JsonParseOptions options) Adds the JSON pointers contained in the new JSON field selector retrieved by parsing the given string.addPointer
(JsonPointer pointer, JsonPointer... furtherPointers) Adds the given JSON pointer(s) to the field selector to be built.addPointers
(Iterable<JsonPointer> pointers) Adds the given JSON pointers to the field selector to be built.addPointerString
(String pointerString, String... furtherPointerStrings) Adds the given JSON pointer(s) (provided as string) to the field selector to be built.addPointerStrings
(Iterable<String> pointerStrings) Adds the given JSON pointers (provided as string) to the field selector to be built.build()
Creates a newJsonFieldSelector
instance containing all JSON Pointers which were added beforehand.removeFieldDefinition
(JsonFieldDefinition<?> fieldDefinition) Removes the JSON Pointer of the given JSON field definition from the field selector to be built.removeFieldDefinitions
(Iterable<JsonFieldDefinition<?>> fieldDefinitions) Removes the JSON Pointers of the given JSON field definitions from the field selector to be built.removePointer
(JsonPointer jsonPointer) Removes the given JSON Pointer from the field selector to be built.removePointers
(Iterable<JsonPointer> jsonPointers) Removes the given JSON Pointers from the field selector to be built.removePointerString
(String pointerString) Removes the JSON Pointer with the given String representation from the field selector to be built.removePointerStrings
(Iterable<String> pointerStrings) Removes the JSON Pointers with the given String representations from the field selector to be built.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
addPointer
Adds the given JSON pointer(s) to the field selector to be built.- Parameters:
pointer
- a JSON pointer to be added to the field selector. Addingnull
has no effect.furtherPointers
- further JSON pointers to be added to the field selector.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException
- iffurtherPointers
isnull
.
-
addPointers
Adds the given JSON pointers to the field selector to be built.- Parameters:
pointers
- the JSON pointers to be added to the field selector.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException
- ifpointers
isnull
.
-
addPointerString
JsonFieldSelectorBuilder addPointerString(@Nullable String pointerString, String... furtherPointerStrings) Adds the given JSON pointer(s) (provided as string) to the field selector to be built.- Parameters:
pointerString
- a JSON pointer string representation to be added to the field selector. Addingnull
has no effect.furtherPointerStrings
- further JSON pointer string representations to be added to the field selector.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException
- iffurtherPointerStrings
isnull
.
-
addPointerStrings
Adds the given JSON pointers (provided as string) to the field selector to be built.- Parameters:
pointerStrings
- the JSON pointers to be added to the field selector.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException
- ifpointerStrings
isnull
.
-
addFieldDefinition
JsonFieldSelectorBuilder addFieldDefinition(@Nullable JsonFieldDefinition<?> fieldDefinition, JsonFieldDefinition<?>... furtherFieldDefinitions) Adds the JSON pointer of each givenJsonFieldDefinition
to the field selector to be built.- Parameters:
fieldDefinition
- the JSON field definition to be added to the field selector. Addingnull
has no effect.furtherFieldDefinitions
- the JSON field definitions to be added to the field selector.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException
- iffurtherFieldDefinitions
isnull
.
-
addFieldDefinitions
Adds the JSON pointer of each givenJsonFieldDefinition
s to the field selector to be built.- Parameters:
fieldDefinitions
- the JSON field definitions providing JSON pointers to be added to the field selector.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException
- iffieldDefinitions
isnull
.
-
addFieldSelector
Adds the Json Pointers from the givenJsonFieldSelector
s to the field selector to be built.- Parameters:
fieldSelector
- the JSON field selector whose JSON pointers are to be added to the field selector.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException
- iffieldSelector
isnull
.
-
addFieldSelectorString
JsonFieldSelectorBuilder addFieldSelectorString(@Nullable String fieldSelectorString, JsonParseOptions options) Adds the JSON pointers contained in the new JSON field selector retrieved by parsing the given string. If the JSON field selector string isnull
or empty this means that no fields were selected thus this method effectively does nothing.For example, the field selector string
"thingId,attributes(acceleration,someData(foo,bar/baz)),features/key"
would lead to a JSON field selector which consists of the following JSON pointers:"thingId"
,"attributes/acceleration"
,"attributes/someData/foo"
,"attributes/someData/bar/baz"
,"features/key"
.
- Parameters:
fieldSelectorString
- string to be transformed into a JSON field selector object.options
- the JsonParseOptions to apply when parsing thefieldSelectorString
.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException
- ifoptions
isnull
.JsonFieldSelectorInvalidException
- iffieldSelectorString
does not contain a closing parenthesis ()
) for each opening parenthesis ((
).IllegalStateException
- iffieldSelectorString
cannot be decoded as UTF-8.
-
addFieldSelectorString
Adds the JSON pointers contained in the new JSON field selector retrieved by parsing the given string. If the JSON field selector string isnull
or empty this means that no fields were selected thus this method effectively does nothing. This method does no URL-encoding!For example, the field selector string
"thingId,attributes(acceleration,someData(foo,bar/baz)),features/key"
would lead to a JSON field selector which consists of the following JSON pointers:
"thingId"
,"attributes/acceleration"
,"attributes/someData/foo"
,"attributes/someData/bar/baz"
,"features/key"
.
- Parameters:
fieldSelectorString
- string to be transformed into a JSON field selector object.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException
- ifoptions
isnull
.JsonFieldSelectorInvalidException
- iffieldSelectorString
does not contain a closing parenthesis ()
) for each opening parenthesis ((
).IllegalStateException
- iffieldSelectorString
cannot be decoded as UTF-8.- See Also:
-
removePointer
Removes the given JSON Pointer from the field selector to be built.- Parameters:
jsonPointer
- the JSON pointer to be removed from the field selector. Removingnull
has no effect.- Returns:
- this builder to allow method chaining.
-
removePointers
Removes the given JSON Pointers from the field selector to be built.- Parameters:
jsonPointers
- the JSON pointers to be removed from the field selector.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException
- ifjsonPointers
isnull
.
-
removePointerString
Removes the JSON Pointer with the given String representation from the field selector to be built.- Parameters:
pointerString
- the string representation of the JSON pointer to be removed from the field selector. Removingnull
has no effect.- Returns:
- this builder to allow method chaining.
-
removePointerStrings
Removes the JSON Pointers with the given String representations from the field selector to be built.- Parameters:
pointerStrings
- the string representations of the JSON pointers to be removed from the field selector.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException
- ifpointerStrings
isnull
.
-
removeFieldDefinition
Removes the JSON Pointer of the given JSON field definition from the field selector to be built.- Parameters:
fieldDefinition
- the field definition which provides the JSON pointer to be removed from the field selector. Removingnull
has no effect.- Returns:
- this builder to allow method chaining.
-
removeFieldDefinitions
Removes the JSON Pointers of the given JSON field definitions from the field selector to be built.- Parameters:
fieldDefinitions
- the field definitions which provides the JSON pointers to be removed from the field selector.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException
- iffieldDefinitions
isnull
.
-
build
JsonFieldSelector build()Creates a newJsonFieldSelector
instance containing all JSON Pointers which were added beforehand.- Returns:
- a new JsonFieldSelector.
-