public abstract class AbstractStateContextLookup extends java.lang.Object implements StateContextLookup
StateContextLookup
implementation. The lookup(Object[])
method will loop through the event arguments and call the supports(Class)
method for each of them. The first argument that this method returns
true for will be passed to the abstract lookup(Object)
method which should try to extract a StateContext
from the argument.
If none is found a new StateContext
will be created and stored in the
event argument using the store(Object, StateContext)
method.构造器和说明 |
---|
AbstractStateContextLookup(StateContextFactory contextFactory)
Creates a new instance which uses the specified
StateContextFactory
to create StateContext objects. |
限定符和类型 | 方法和说明 |
---|---|
protected abstract StateContext |
lookup(java.lang.Object eventArg)
Extracts a
StateContext from the specified event argument which
is an instance of a class supports(Class) returns
true for. |
StateContext |
lookup(java.lang.Object[] eventArgs)
Searches the arguments from an
Event and returns a
StateContext if any of the arguments holds one. |
protected abstract void |
store(java.lang.Object eventArg,
StateContext context)
Stores a new
StateContext in the specified event argument which
is an instance of a class supports(Class) returns
true for. |
protected abstract boolean |
supports(java.lang.Class<?> c)
Must return true for any
Class that this
StateContextLookup can use to store and lookup
StateContext objects. |
public AbstractStateContextLookup(StateContextFactory contextFactory)
StateContextFactory
to create StateContext
objects.contextFactory
- the factory.public StateContext lookup(java.lang.Object[] eventArgs)
StateContextLookup
Event
and returns a
StateContext
if any of the arguments holds one. NOTE! This method
must create a new StateContext
if a compatible object is in
the arguments and the next time that same object is passed to this
method the same StateContext
should be returned.lookup
在接口中 StateContextLookup
eventArgs
- The arguments we are looking forprotected abstract StateContext lookup(java.lang.Object eventArg)
StateContext
from the specified event argument which
is an instance of a class supports(Class)
returns
true for.eventArg
- the event argument.StateContext
.protected abstract void store(java.lang.Object eventArg, StateContext context)
StateContext
in the specified event argument which
is an instance of a class supports(Class)
returns
true for.eventArg
- the event argument.context
- the StateContext
to be stored.protected abstract boolean supports(java.lang.Class<?> c)
Class
that this
StateContextLookup
can use to store and lookup
StateContext
objects.c
- the class.