Interface KeyValueMatcher<V>

Type Parameters:
V - The value type
All Superinterfaces:
DataSerializable

public interface KeyValueMatcher<V> extends DataSerializable
Represents a matcher for Key values.

This matcher can only be serialized if the underlying value KeyValueMatcher can also be serialized.

  • Method Details

    • of

      static <V> KeyValueMatcher<V> of(Key<? extends Value<V>> key, V value)
      Creates a KeyValueMatcher from the given key and value. The default operator KeyValueMatcher.Operator.EQUAL will be used.
      Type Parameters:
      V - The value type
      Parameters:
      key - The key of which the value should be matched
      value - The matcher value that key values will be matched against
      Returns:
      The key value matcher
    • of

      static <V> KeyValueMatcher<V> of(Key<? extends Value<V>> key, V value, KeyValueMatcher.Operator operator)
      Creates a KeyValueMatcher from the given key, value and operator.
      Type Parameters:
      V - The value type
      Parameters:
      key - The key of which the value should be matched
      value - The matcher value that key values will be matched against
      operator - The operator how the value should be matched
      Returns:
      The key value matcher
    • builder

      static KeyValueMatcher.Builder<?> builder()
      Constructs a new KeyValueMatcher.Builder to create KeyValueMatchers.
      Returns:
      The builder
    • key

      Key<? extends Value<V>> key()
      Gets the Key that is being used to match key and matcher values.
      Returns:
      The key
    • operator

      Gets the operator of the matcher.
      Returns:
      The operator
    • value

      Optional<V> value()
      Gets the value of the query. A empty optional represents the property not being present.
      Returns:
      The value
    • matchesContainer

      default boolean matchesContainer(ValueContainer valueContainer)
      Checks whether the value of the ValueContainer is matched by this matcher.
      Parameters:
      valueContainer - The value container to get the key value from
      Returns:
      Whether this matcher matches the key value
    • matches

      boolean matches(@Nullable V value)
      Checks whether the given value is matched by this matcher.
      Parameters:
      value - The key value, a null value represents that the key doesn't exist
      Returns:
      Whether this matcher matches the key value