Interface JsonFieldSelectorBuilder

All Superinterfaces:
Iterable<JsonPointer>

public interface JsonFieldSelectorBuilder extends 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 Details

    • addPointer

      JsonFieldSelectorBuilder addPointer(@Nullable JsonPointer pointer, JsonPointer... furtherPointers)
      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. Adding null has no effect.
      furtherPointers - further JSON pointers to be added to the field selector.
      Returns:
      this builder to allow method chaining.
      Throws:
      NullPointerException - if furtherPointers is null.
    • 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 - if pointers is null.
    • 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. Adding null 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 - if furtherPointerStrings is null.
    • addPointerStrings

      JsonFieldSelectorBuilder addPointerStrings(Iterable<String> pointerStrings)
      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 - if pointerStrings is null.
    • addFieldDefinition

      JsonFieldSelectorBuilder addFieldDefinition(@Nullable JsonFieldDefinition<?> fieldDefinition, JsonFieldDefinition<?>... furtherFieldDefinitions)
      Adds the JSON pointer of each given JsonFieldDefinition to the field selector to be built.
      Parameters:
      fieldDefinition - the JSON field definition to be added to the field selector. Adding null has no effect.
      furtherFieldDefinitions - the JSON field definitions to be added to the field selector.
      Returns:
      this builder to allow method chaining.
      Throws:
      NullPointerException - if furtherFieldDefinitions is null.
    • addFieldDefinitions

      JsonFieldSelectorBuilder addFieldDefinitions(Iterable<JsonFieldDefinition<?>> fieldDefinitions)
      Adds the JSON pointer of each given JsonFieldDefinitions 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 - if fieldDefinitions is null.
    • addFieldSelector

      JsonFieldSelectorBuilder addFieldSelector(JsonFieldSelector fieldSelector)
      Adds the Json Pointers from the given JsonFieldSelectors 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 - if fieldSelector is null.
    • 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 is null 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 the fieldSelectorString.
      Returns:
      this builder to allow method chaining.
      Throws:
      NullPointerException - if options is null.
      JsonFieldSelectorInvalidException - if fieldSelectorString does not contain a closing parenthesis ()) for each opening parenthesis (().
      IllegalStateException - if fieldSelectorString cannot be decoded as UTF-8.
    • addFieldSelectorString

      JsonFieldSelectorBuilder addFieldSelectorString(@Nullable String fieldSelectorString)
      Adds the JSON pointers contained in the new JSON field selector retrieved by parsing the given string. If the JSON field selector string is null 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 - if options is null.
      JsonFieldSelectorInvalidException - if fieldSelectorString does not contain a closing parenthesis ()) for each opening parenthesis (().
      IllegalStateException - if fieldSelectorString cannot be decoded as UTF-8.
      See Also:
    • removePointer

      JsonFieldSelectorBuilder removePointer(@Nullable JsonPointer jsonPointer)
      Removes the given JSON Pointer from the field selector to be built.
      Parameters:
      jsonPointer - the JSON pointer to be removed from the field selector. Removing null has no effect.
      Returns:
      this builder to allow method chaining.
    • removePointers

      JsonFieldSelectorBuilder removePointers(Iterable<JsonPointer> jsonPointers)
      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 - if jsonPointers is null.
    • removePointerString

      JsonFieldSelectorBuilder removePointerString(@Nullable String pointerString)
      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. Removing null has no effect.
      Returns:
      this builder to allow method chaining.
    • removePointerStrings

      JsonFieldSelectorBuilder removePointerStrings(Iterable<String> pointerStrings)
      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 - if pointerStrings is null.
    • removeFieldDefinition

      JsonFieldSelectorBuilder removeFieldDefinition(@Nullable JsonFieldDefinition<?> fieldDefinition)
      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. Removing null has no effect.
      Returns:
      this builder to allow method chaining.
    • removeFieldDefinitions

      JsonFieldSelectorBuilder removeFieldDefinitions(Iterable<JsonFieldDefinition<?>> fieldDefinitions)
      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 - if fieldDefinitions is null.
    • build

      Creates a new JsonFieldSelector instance containing all JSON Pointers which were added beforehand.
      Returns:
      a new JsonFieldSelector.