S - StateE - EventT - Event TypeC - ContextM - Target Machine Typepublic final class StateMachineBuilder<S,E,T,C,M extends StateMachine<S,E,T>> extends Object
SimpleStateMachines.| Modifier and Type | Method and Description |
|---|---|
M |
build()
Builds a new state machine of target type M from this builder.
|
static StateMachineBuilder<Object,Object,Object,Void,GenericStateMachine> |
create()
Creates a new Builder that builds a state machine which accepts any kinds
of objects as States, Events, etc.
|
static <S,E,T,M extends SimpleStateMachine<S,E,T>> |
create(Class<M> iface)
Creates a new builder that builds state machines from an interface
definition.
|
static <S,E> StateMachineBuilder<S,E,E,Void,SimpleStateMachine<S,E,E>> |
create(Class<S> states,
Class<E> events)
Creates a new Builder that builds simple state machines.
|
static <S,E,T> StateMachineBuilder<S,E,T,Void,SimpleStateMachine<S,E,T>> |
create(Class<S> states,
Class<E> events,
Class<T> eventTypes)
Creates a new builder that builds state machines with a distinct event
type.
|
static <S,E,T,C,M extends StateMachineWithContext<S,E,T,C>> |
createWithContext(Class<M> iface)
Creates a builder that builds state machines with a distinct event type and
a computational context from an interface definition.
|
static <S,E,T,C> StateMachineBuilder<S,E,E,C,StateMachineWithContext<S,E,E,C>> |
createWithContext(Class<S> states,
Class<E> events,
Class<C> context)
Creates a builder that builds state machines with a computational context.
|
static <S,E,T,C> StateMachineBuilder<S,E,T,C,StateMachineWithContext<S,E,T,C>> |
createWithContext(Class<S> states,
Class<E> events,
Class<T> eventTypes,
Class<C> context)
Creates a builder that builds state machines with a distinct event type and
a computational context.
|
StateMachineBuilder<S,E,T,C,M> |
withCatchall(S from,
S to) |
StateMachineBuilder<S,E,T,C,M> |
withEventTypeClassifier(EventTypeClassifier<E,T> eventTypeClassifier) |
StateMachineBuilder<S,E,T,C,M> |
withFallback(S from,
S to) |
StateMachineBuilder<S,E,T,C,M> |
withInitialState(S initialState) |
StateMachineBuilder<S,E,T,C,M> |
withListener(StateMachineListener<S,E,T,C> listener)
Define a new listener.
|
StateMachineBuilder<S,E,T,C,M> |
withTransition(S from,
T on,
S to)
Define a new transition.
|
StateMachineBuilder<S,E,T,C,M> |
withTransition(S from,
T on,
S to,
Guard<E,C> guard)
Define a new transition guarded by a
Guard. |
StateMachineBuilder<S,E,T,C,M> |
withTransition(S from,
T on,
S to,
String guard)
Define a new transition guarded by an MVEL expression.
|
StateMachineBuilder<S,E,T,C,M> |
withTransitions(Transition.TransitionBuilder2<S,T>... transitions)
Defines a bunch of new Transitions using
Transition.from(Object). |
public static StateMachineBuilder<Object,Object,Object,Void,GenericStateMachine> create()
GenericStateMachine.public static <S,E> StateMachineBuilder<S,E,E,Void,SimpleStateMachine<S,E,E>> create(Class<S> states, Class<E> events)
states - The class that all states inherit from.events - The class that all events inherit from.public static <S,E,T> StateMachineBuilder<S,E,T,Void,SimpleStateMachine<S,E,T>> create(Class<S> states, Class<E> events, Class<T> eventTypes)
states - The class that all states inherit from.events - The class that all events inherit from.eventTypes - The class that all event types inherit from.public static <S,E,T,M extends SimpleStateMachine<S,E,T>> StateMachineBuilder<S,E,T,Void,M> create(Class<M> iface)
iface - The interface to read the state, event, event types and context
classes form. This interface must implement
SimpleStateMachine. The types are read from the
ParameterizedType.public static <S,E,T,C> StateMachineBuilder<S,E,E,C,StateMachineWithContext<S,E,E,C>> createWithContext(Class<S> states, Class<E> events, Class<C> context)
states - The class that all states inherit from.events - The class that all events inherit from.context - The class that implements the context.public static <S,E,T,C> StateMachineBuilder<S,E,T,C,StateMachineWithContext<S,E,T,C>> createWithContext(Class<S> states, Class<E> events, Class<T> eventTypes, Class<C> context)
states - The class that all states inherit from.events - The class that all events inherit from.eventTypes - The class that all event types inherit from.context - The class that implements the context.public static <S,E,T,C,M extends StateMachineWithContext<S,E,T,C>> StateMachineBuilder<S,E,T,C,M> createWithContext(Class<M> iface)
iface - The interface to read the state, event, event types and context
classes form. This interface must implement
StateMachineWithContext. The types are read from the
ParameterizedType.public StateMachineBuilder<S,E,T,C,M> withTransition(S from, T on, S to)
from - The state from which this transition originates.on - The event on which this transition is eligible.to - The state this transition leads to.@SafeVarargs public final StateMachineBuilder<S,E,T,C,M> withTransitions(Transition.TransitionBuilder2<S,T>... transitions)
Transition.from(Object).transitions - public StateMachineBuilder<S,E,T,C,M> withFallback(S from, S to)
from - to - public StateMachineBuilder<S,E,T,C,M> withCatchall(S from, S to)
from - to - public StateMachineBuilder<S,E,T,C,M> withTransition(S from, T on, S to, String guard)
e, event,
c, and code to refer the the current Event of
type E and the context of type C.from - The state from which this transition originates.on - The event on which this transition is eligible.to - The state this transition leads to.guard - The guard (an MVEL expression which has to evaluate to true) that
has to be passed before this transition can be considered
eligible.public StateMachineBuilder<S,E,T,C,M> withTransition(S from, T on, S to, Guard<E,C> guard)
Guard.from - The state from which this transition originates.on - The event on which this transition is eligible.to - The state this transition leads to.guard - The guard that has to be passed before this transition can be
considered eligible.public StateMachineBuilder<S,E,T,C,M> withListener(StateMachineListener<S,E,T,C> listener)
listener - The listener.public M build()
@Generated(value="lombok") public StateMachineBuilder<S,E,T,C,M> withInitialState(S initialState)
@Generated(value="lombok") public StateMachineBuilder<S,E,T,C,M> withEventTypeClassifier(EventTypeClassifier<E,T> eventTypeClassifier)
Copyright © 2015. All rights reserved.