Interface JsonFieldSelector

All Superinterfaces:
Iterable<JsonPointer>

public interface JsonFieldSelector extends Iterable<JsonPointer>
A JsonFieldSelector is basically a set of JsonPointers. 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 Type
    Method
    Description
    Returns the JsonPointers on which this field selector is based.
    int
    Returns the size of this JSON field selector, i.
    boolean
    Indicates whether this field selector is empty.
    newInstance(CharSequence pointerString, CharSequence... furtherPointerStrings)
    Returns a new JSON field selector which is based on the given JsonPointer(s).
    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 given JsonPointer(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 is null.
    • getPointers

      Set<JsonPointer> getPointers()
      Returns the JsonPointers 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.
      Overrides:
      toString in class Object
      Returns:
      either the original JSON field selector string or a typical string representation of this object.