Package org.spongepowered.api.data
Interface KeyValueMatcher<V>
- 
- Type Parameters:
- V- The value type
 - All Superinterfaces:
- DataSerializable
 
 public interface KeyValueMatcher<V> extends DataSerializable Represents a matcher forKeyvalues.This matcher can only be serialized if the underlying value KeyValueMatchercan also be serialized.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static interfaceKeyValueMatcher.Builder<V>A builder to createKeyValueMatchers.static classKeyValueMatcher.OperatorRepresents a operator to match the values of a key query.
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static KeyValueMatcher.Builder<?>builder()Constructs a newKeyValueMatcher.Builderto createKeyValueMatchers.Key<? extends Value<V>>key()Gets theKeythat is being used to match key and matcher values.booleanmatches(@Nullable V value)Checks whether the given value is matched by this matcher.default booleanmatchesContainer(ValueContainer valueContainer)Checks whether the value of theValueContaineris matched by this matcher.static <V> KeyValueMatcher<V>of(Key<? extends Value<V>> key, V value)Creates aKeyValueMatcherfrom the given key and value.static <V> KeyValueMatcher<V>of(Key<? extends Value<V>> key, V value, KeyValueMatcher.Operator operator)Creates aKeyValueMatcherfrom the given key, value and operator.KeyValueMatcher.Operatoroperator()Gets the operator of the matcher.Optional<V>value()Gets the value of the query.- 
Methods inherited from interface org.spongepowered.api.data.persistence.DataSerializablecontentVersion, toContainer
 
- 
 
- 
- 
- 
Method Detail- 
ofstatic <V> KeyValueMatcher<V> of(Key<? extends Value<V>> key, V value) Creates aKeyValueMatcherfrom the given key and value. The default operatorKeyValueMatcher.Operator.EQUALwill 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
 
 - 
ofstatic <V> KeyValueMatcher<V> of(Key<? extends Value<V>> key, V value, KeyValueMatcher.Operator operator) Creates aKeyValueMatcherfrom 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
 
 - 
builderstatic KeyValueMatcher.Builder<?> builder() Constructs a newKeyValueMatcher.Builderto createKeyValueMatchers.- Returns:
- The builder
 
 - 
keyKey<? extends Value<V>> key() Gets theKeythat is being used to match key and matcher values.- Returns:
- The key
 
 - 
operatorKeyValueMatcher.Operator operator() Gets the operator of the matcher.- Returns:
- The operator
 
 - 
valueOptional<V> value() Gets the value of the query. A empty optional represents the property not being present.- Returns:
- The value
 
 - 
matchesContainerdefault boolean matchesContainer(ValueContainer valueContainer) Checks whether the value of theValueContaineris matched by this matcher.- Parameters:
- valueContainer- The value container to get the key value from
- Returns:
- Whether this matcher matches the key value
 
 - 
matchesboolean 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
 
 
- 
 
-