public abstract class

ValueMatcher

extends Object
implements Predicate<T> JsonSerializable
java.lang.Object
   ↳ com.urbanairship.json.ValueMatcher

Class Overview

Class representing the field matching type and values contained in a JsonMatcher.

Summary

Protected Constructors
ValueMatcher()
Public Methods
boolean apply(JsonSerializable jsonSerializable)
static ValueMatcher newArrayContainsMatcher(JsonPredicate predicate, int index)
Creates a new array contains matcher for a specific value in the array.
static ValueMatcher newArrayContainsMatcher(JsonPredicate predicate)
Creates a new array contains matcher that will check the entire array.
static ValueMatcher newIsAbsentMatcher()
Creates a new value matcher for when a field should be absent.
static ValueMatcher newIsPresentMatcher()
Creates a new value matcher for when a field should be present.
static ValueMatcher newNumberRangeMatcher(Double min, Double max)
Creates a new number range value matcher.
static ValueMatcher newValueMatcher(JsonValue value)
Creates a new value matcher.
static ValueMatcher newVersionMatcher(String constraint)
Creates a new value matcher for a semantic version string
static ValueMatcher parse(JsonValue jsonValue)
Parses a JsonValue object into a ValueMatcher.
String toString()
Protected Methods
abstract boolean apply(JsonValue jsonValue, boolean ignoreCase)
Matches a json value.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.urbanairship.Predicate
From interface com.urbanairship.json.JsonSerializable

Protected Constructors

protected ValueMatcher ()

Public Methods

public boolean apply (JsonSerializable jsonSerializable)

public static ValueMatcher newArrayContainsMatcher (JsonPredicate predicate, int index)

Creates a new array contains matcher for a specific value in the array.

Parameters
predicate The predicate to apply to the value at the specified index.
index The index of the value.
Returns
  • A new ValueMatcher instance.

public static ValueMatcher newArrayContainsMatcher (JsonPredicate predicate)

Creates a new array contains matcher that will check the entire array.

Parameters
predicate The predicate to apply to each value of the array.
Returns
  • A new ValueMatcher instance.

public static ValueMatcher newIsAbsentMatcher ()

Creates a new value matcher for when a field should be absent.

Returns
  • A new ValueMatcher instance.

public static ValueMatcher newIsPresentMatcher ()

Creates a new value matcher for when a field should be present.

Returns
  • A new ValueMatcher instance.

public static ValueMatcher newNumberRangeMatcher (Double min, Double max)

Creates a new number range value matcher.

Parameters
min Optional minimum value as a double.
max Optional maximum value as a double.
Returns
  • A new ValueMatcher instance.
Throws
IllegalArgumentException if min is greater than max.

public static ValueMatcher newValueMatcher (JsonValue value)

Creates a new value matcher.

Parameters
value The value to apply as a JsonValue.
Returns
  • A new ValueMatcher instance.

public static ValueMatcher newVersionMatcher (String constraint)

Creates a new value matcher for a semantic version string

Returns
  • A new ValueMatcher instance.
Throws
IllegalArgumentException If the constraint is not a valid ivy version constraint.

public static ValueMatcher parse (JsonValue jsonValue)

Parses a JsonValue object into a ValueMatcher.

Parameters
jsonValue The predicate as a JsonValue.
Returns
  • The matcher as a ValueMatcher.
Throws
JsonException

public String toString ()

Protected Methods

protected abstract boolean apply (JsonValue jsonValue, boolean ignoreCase)

Matches a json value.

Parameters
jsonValue The json value.
ignoreCase true to ignore case when checking String values, false to check case.
Returns
  • true if the value matches, otherwise false.