/** * Returns a new instance of {@code ImmutableJsonFieldSelector} based on the given JSON pointers. The order of the * pointers is maintained, for example if {@code pointers} is sorted or a LinkedHashSet. * * @param pointers a set of {@link JsonPointer}s which are the base of the returned field selector. Empty pointers * are ignored. * @return a new JSON field selector which is based on the given JSON pointers. * @throws NullPointerException if {@code pointers} is {@code null}. */ public static ImmutableJsonFieldSelector of(final Iterable<JsonPointer> pointers) { return of(pointers, null); }
/** * Returns a new instance of {@code ImmutableJsonFieldSelector} based on the given JSON pointers. The order of the * pointers is maintained, for example if {@code pointers} is sorted or a LinkedHashSet. * * @param pointers a set of {@link JsonPointer}s which are the base of the returned field selector. Empty pointers * are ignored. * @return a new JSON field selector which is based on the given JSON pointers. * @throws NullPointerException if {@code pointers} is {@code null}. */ public static ImmutableJsonFieldSelector of(final Iterable<JsonPointer> pointers) { return of(pointers, null); }
@Override public JsonFieldSelector build() { return ImmutableJsonFieldSelector.of(pointers, jsonFieldSelectorString); }
@Override public JsonFieldSelector build() { return ImmutableJsonFieldSelector.of(pointers, jsonFieldSelectorString); }
/** * Returns a new instance of {@code ImmutableJsonFieldSelector} with empty JSON pointers. * * @return a new empty JSON field selector. */ public static ImmutableJsonFieldSelector empty() { return of(Collections.emptyList(), null); }
/** * Returns a new instance of {@code ImmutableJsonFieldSelector} with empty JSON pointers. * * @return a new empty JSON field selector. */ public static ImmutableJsonFieldSelector empty() { return of(Collections.emptyList(), null); }
/** * Returns a new JSON field selector which is based on the given set of {@link JsonPointer}s. If the set of JSON * pointers string is empty this means that no fields were selected thus this method returns an empty JSON field * selector. * * @param pointers the JSON pointers of the field selector to be created. * @return a new JSON field selector. * @throws NullPointerException if {@code pointers} is {@code null}. * @throws IllegalArgumentException if {@code pointers} is empty. */ public static JsonFieldSelector newFieldSelector(final Iterable<JsonPointer> pointers) { requireNonNull(pointers, "In order to create a JSON field selector the JSON pointers must not be null!"); return ImmutableJsonFieldSelector.of(pointers); }
/** * Returns a new JSON field selector which is based on the given set of {@link JsonPointer}s. * If the set of JSON pointers string is empty this means that no fields were selected thus this method returns an * empty JSON field selector. * * @param pointers the JSON pointers of the field selector to be created. * @return a new JSON field selector. * @throws NullPointerException if {@code pointers} is {@code null}. * @throws IllegalArgumentException if {@code pointers} is empty. */ public static JsonFieldSelector newFieldSelector(final Iterable<JsonPointer> pointers) { requireNonNull(pointers, "In order to create a JSON field selector the JSON pointers must not be null!"); return ImmutableJsonFieldSelector.of(pointers); }
/** * Returns a new JSON field selector which is based on the given {@link JsonPointer}(s). * * @param pointer a JSON pointer of the field selector to be created. * @param furtherPointers additional JSON pointers to form the field selector to be created by this method. * @return a new JSON field selector. * @throws NullPointerException if any argument is {@code null}. */ public static JsonFieldSelector newFieldSelector(final JsonPointer pointer, final JsonPointer... furtherPointers) { requireNonNull(pointer, "The JSON pointer must not be null!"); requireNonNull(furtherPointers, "The optional JSON keys must not be null!"); final Collection<JsonPointer> jsonPointers = new LinkedHashSet<>(1 + furtherPointers.length); jsonPointers.add(pointer); Collections.addAll(jsonPointers, furtherPointers); return ImmutableJsonFieldSelector.of(jsonPointers); }
/** * Returns a new JSON field selector which is based on the given {@link JsonPointer}(s). * * @param pointer a JSON pointer of the field selector to be created. * @param furtherPointers additional JSON pointers to form the field selector to be created by this method. * @return a new JSON field selector. * @throws NullPointerException if any argument is {@code null}. */ public static JsonFieldSelector newFieldSelector(final JsonPointer pointer, final JsonPointer... furtherPointers) { requireNonNull(pointer, "The JSON pointer must not be null!"); requireNonNull(furtherPointers, "The optional JSON keys must not be null!"); final Collection<JsonPointer> jsonPointers = new LinkedHashSet<>(1 + furtherPointers.length); jsonPointers.add(pointer); Collections.addAll(jsonPointers, furtherPointers); return ImmutableJsonFieldSelector.of(jsonPointers); }
/** * Returns a new JSON field selector which is based on the given {@link JsonPointer}(s). * * @param pointerString a JSON pointer of the field selector to be created. * @param furtherPointerStrings additional JSON pointers to form the field selector to be created by this method. * @return a new JSON field selector. * @throws NullPointerException if any argument is {@code null}. */ public static JsonFieldSelector newFieldSelector(final CharSequence pointerString, final CharSequence... furtherPointerStrings) { requireNonNull(pointerString, "The JSON pointer string must not be null!"); requireNonNull(furtherPointerStrings, "The optional JSON keys must not be null!"); final Collection<JsonPointer> jsonPointers = new LinkedHashSet<>(1 + furtherPointerStrings.length); jsonPointers.add(newPointer(pointerString)); for (final CharSequence furtherPointerString : furtherPointerStrings) { jsonPointers.add(newPointer(furtherPointerString)); } return ImmutableJsonFieldSelector.of(jsonPointers); }
/** * Returns a new JSON field selector which is based on the given {@link JsonPointer}(s). * * @param pointerString a JSON pointer of the field selector to be created. * @param furtherPointerStrings additional JSON pointers to form the field selector to be created by this method. * @return a new JSON field selector. * @throws NullPointerException if any argument is {@code null}. */ public static JsonFieldSelector newFieldSelector(final CharSequence pointerString, final CharSequence... furtherPointerStrings) { requireNonNull(pointerString, "The JSON pointer string must not be null!"); requireNonNull(furtherPointerStrings, "The optional JSON keys must not be null!"); final Collection<JsonPointer> jsonPointers = new LinkedHashSet<>(1 + furtherPointerStrings.length); jsonPointers.add(newPointer(pointerString)); for (final CharSequence furtherPointerString : furtherPointerStrings) { jsonPointers.add(newPointer(furtherPointerString)); } return ImmutableJsonFieldSelector.of(jsonPointers); }
/** * Returns a new JSON field selector based on the parsed string which was given to this class' constructor. * * @return a new JSON field selector instance. * @throws IllegalStateException if the JSON field selector string could not be decoded as UTF-8. */ public JsonFieldSelector newJsonFieldSelector() { final List<String> rawJsonKeys = splitAroundComma(jsonFieldSelectorString); final Set<JsonPointer> jsonPointers = flattenToJsonPointers(rawJsonKeys); return ImmutableJsonFieldSelector.of(jsonPointers, jsonFieldSelectorString); } }
/** * Returns a new JSON field selector based on the parsed string which was given to this class' constructor. * * @return a new JSON field selector instance. * @throws IllegalStateException if the JSON field selector string could not be decoded as UTF-8. */ public JsonFieldSelector newJsonFieldSelector() { final List<String> rawJsonKeys = splitAroundComma(jsonFieldSelectorString); final Set<JsonPointer> jsonPointers = flattenToJsonPointers(rawJsonKeys); return ImmutableJsonFieldSelector.of(jsonPointers, jsonFieldSelectorString); } }