Package org.spongepowered.api.state
Interface StateMatcher.Builder<S extends State<S>,T extends StateContainer<S>>
- All Superinterfaces:
AbstractBuilder<StateMatcher<S>>,Builder<StateMatcher<S>,,StateMatcher.Builder<S, T>> CopyableBuilder<StateMatcher<S>,,StateMatcher.Builder<S, T>> ResettableBuilder<StateMatcher<S>,StateMatcher.Builder<S, T>>
- Enclosing interface:
StateMatcher<S extends State<S>>
public static interface StateMatcher.Builder<S extends State<S>,T extends StateContainer<S>>
extends Builder<StateMatcher<S>,StateMatcher.Builder<S,T>>, CopyableBuilder<StateMatcher<S>,StateMatcher.Builder<S,T>>
A builder for
StateMatchers.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds aStateMatcher.matcher(KeyValueMatcher<?> matcher) Adds aKeyValueMatcherthat theStateneeds to match with.default <V extends Comparable<V>>
StateMatcher.Builder<S, T> stateProperty(Supplier<? extends StateProperty<V>> stateProperty, V value) Adds aStatePropertyand value that needs to match on aStateto match.<V extends Comparable<V>>
StateMatcher.Builder<S, T> stateProperty(StateProperty<V> stateProperty, V value) Adds aStatePropertyand value that needs to match on aStateto match.default StateMatcher.Builder<S, T> supportsStateProperty(Supplier<? extends StateProperty<? extends @NonNull Object>> stateProperty) Adds aStatePropertythat needs to be present on aStateto match.supportsStateProperty(StateProperty<? extends @NonNull Object> stateProperty) Adds aStatePropertythat needs to be present on aStateto match.default StateMatcher.Builder<S, T> Sets the rootStateContainerfor theStateMatcher.Sets the rootStateContainerfor theStateMatcher.Methods inherited from interface org.spongepowered.api.util.CopyableBuilder
from
-
Method Details
-
type
Sets the rootStateContainerfor theStateMatcher.- Parameters:
type- TheStateContainerto use- Returns:
- This builder, for chaining
-
type
Sets the rootStateContainerfor theStateMatcher.- Parameters:
type- TheStateContainerto use- Returns:
- This builder, for chaining
-
supportsStateProperty
StateMatcher.Builder<S,T> supportsStateProperty(StateProperty<? extends @NonNull Object> stateProperty) Adds aStatePropertythat needs to be present on aStateto match.type(StateContainer)ortype(Supplier)must be called before this is called as supportedstate propertiesare specific to the type- Parameters:
stateProperty- The state property- Returns:
- This builder, for chaining
-
supportsStateProperty
default StateMatcher.Builder<S,T> supportsStateProperty(Supplier<? extends StateProperty<? extends @NonNull Object>> stateProperty) Adds aStatePropertythat needs to be present on aStateto match.type(StateContainer)ortype(Supplier)must be called before this is called as supportedstate propertiesare specific to the type- Parameters:
stateProperty- The state property- Returns:
- This builder, for chaining
-
stateProperty
<V extends Comparable<V>> StateMatcher.Builder<S,T> stateProperty(StateProperty<V> stateProperty, V value) Adds aStatePropertyand value that needs to match on aStateto match.type(StateContainer)ortype(Supplier)must be called before this is called as supportedstate propertiesare specific to the type- Type Parameters:
V- The value type- Parameters:
stateProperty- The state propertyvalue- The value to match- Returns:
- This builder, for chaining
-
stateProperty
default <V extends Comparable<V>> StateMatcher.Builder<S,T> stateProperty(Supplier<? extends StateProperty<V>> stateProperty, V value) Adds aStatePropertyand value that needs to match on aStateto match.- Type Parameters:
V- The value type- Parameters:
stateProperty- The state propertyvalue- The value to match- Returns:
- This builder, for chaining
-
matcher
Adds aKeyValueMatcherthat theStateneeds to match with.- Parameters:
matcher- The matcher- Returns:
- This builder, for chaining
-
build
StateMatcher<S> build()Builds aStateMatcher.- Specified by:
buildin interfaceAbstractBuilder<S extends State<S>>- Returns:
- The built state matcher
-