Package org.spongepowered.api.state
Interface StateMatcher.Builder<S extends State<S>,T extends StateContainer<S>>
-
- All Superinterfaces:
AbstractBuilder<StateMatcher<S>>
,Buildable.Builder<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 forStateMatcher
s.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description StateMatcher<S>
build()
Builds aStateMatcher
.StateMatcher.Builder<S,T>
matcher(KeyValueMatcher<?> matcher)
Adds aKeyValueMatcher
that theState
needs to match with.default <V extends java.lang.Comparable<V>>
StateMatcher.Builder<S,T>stateProperty(java.util.function.Supplier<? extends StateProperty<V>> stateProperty, V value)
Adds aStateProperty
and value that needs to match on aState
to match.<V extends java.lang.Comparable<V>>
StateMatcher.Builder<S,T>stateProperty(StateProperty<V> stateProperty, V value)
Adds aStateProperty
and value that needs to match on aState
to match.default StateMatcher.Builder<S,T>
supportsStateProperty(java.util.function.Supplier<? extends StateProperty<?>> stateProperty)
Adds aStateProperty
that needs to be present on aState
to match.StateMatcher.Builder<S,T>
supportsStateProperty(StateProperty<?> stateProperty)
Adds aStateProperty
that needs to be present on aState
to match.default StateMatcher.Builder<S,T>
type(java.util.function.Supplier<? extends T> type)
Sets the rootStateContainer
for theStateMatcher
.StateMatcher.Builder<S,T>
type(T type)
Sets the rootStateContainer
for theStateMatcher
.-
Methods inherited from interface org.spongepowered.api.util.CopyableBuilder
from
-
-
-
-
Method Detail
-
type
default StateMatcher.Builder<S,T> type(java.util.function.Supplier<? extends T> type)
Sets the rootStateContainer
for theStateMatcher
.- Parameters:
type
- TheStateContainer
to use- Returns:
- This builder, for chaining
-
type
StateMatcher.Builder<S,T> type(T type)
Sets the rootStateContainer
for theStateMatcher
.- Parameters:
type
- TheStateContainer
to use- Returns:
- This builder, for chaining
-
supportsStateProperty
StateMatcher.Builder<S,T> supportsStateProperty(StateProperty<?> stateProperty)
Adds aStateProperty
that needs to be present on aState
to match.type(StateContainer)
ortype(Supplier)
must be called before this is called as supportedstate properties
are specific to the type- Parameters:
stateProperty
- The state property- Returns:
- This builder, for chaining
-
supportsStateProperty
default StateMatcher.Builder<S,T> supportsStateProperty(java.util.function.Supplier<? extends StateProperty<?>> stateProperty)
Adds aStateProperty
that needs to be present on aState
to match.type(StateContainer)
ortype(Supplier)
must be called before this is called as supportedstate properties
are specific to the type- Parameters:
stateProperty
- The state property- Returns:
- This builder, for chaining
-
stateProperty
<V extends java.lang.Comparable<V>> StateMatcher.Builder<S,T> stateProperty(StateProperty<V> stateProperty, V value)
Adds aStateProperty
and value that needs to match on aState
to match.type(StateContainer)
ortype(Supplier)
must be called before this is called as supportedstate properties
are 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 java.lang.Comparable<V>> StateMatcher.Builder<S,T> stateProperty(java.util.function.Supplier<? extends StateProperty<V>> stateProperty, V value)
Adds aStateProperty
and value that needs to match on aState
to match.- Type Parameters:
V
- The value type- Parameters:
stateProperty
- The state propertyvalue
- The value to match- Returns:
- This builder, for chaining
-
matcher
StateMatcher.Builder<S,T> matcher(KeyValueMatcher<?> matcher)
Adds aKeyValueMatcher
that theState
needs to match with.- Parameters:
matcher
- The matcher- Returns:
- This builder, for chaining
-
build
StateMatcher<S> build()
Builds aStateMatcher
.- Specified by:
build
in interfaceAbstractBuilder<S extends State<S>>
- Specified by:
build
in interfaceBuildable.Builder<S extends State<S>>
- Returns:
- The built state matcher
-
-