Class AbstractStateContextLookup
java.lang.Object
org.apache.mina.statemachine.context.AbstractStateContextLookup
- All Implemented Interfaces:
StateContextLookup
- Direct Known Subclasses:
IoSessionStateContextLookup
Abstract
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.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractStateContextLookup(StateContextFactory contextFactory) Creates a new instance which uses the specifiedStateContextFactoryto createStateContextobjects. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract StateContextExtracts aStateContextfrom the specified event argument which is an instance of a classsupports(Class)returnstruefor.Searches the arguments from anEventand returns aStateContextif any of the arguments holds one.protected abstract voidstore(Object eventArg, StateContext context) Stores a newStateContextin the specified event argument which is an instance of a classsupports(Class)returnstruefor.protected abstract booleanMust returntruefor anyClassthat thisStateContextLookupcan use to store and lookupStateContextobjects.
-
Field Details
-
contextFactory
-
-
Constructor Details
-
AbstractStateContextLookup
Creates a new instance which uses the specifiedStateContextFactoryto createStateContextobjects.- Parameters:
contextFactory- the factory.
-
-
Method Details
-
lookup
Description copied from interface:StateContextLookupSearches the arguments from anEventand returns aStateContextif any of the arguments holds one. NOTE! This method must create a newStateContextif a compatible object is in the arguments and the next time that same object is passed to this method the sameStateContextshould be returned.- Specified by:
lookupin interfaceStateContextLookup- Parameters:
eventArgs- The arguments we are looking for- Returns:
- The StateContext we are looking for
-
lookup
Extracts aStateContextfrom the specified event argument which is an instance of a classsupports(Class)returnstruefor.- Parameters:
eventArg- the event argument.- Returns:
- the
StateContext.
-
store
Stores a newStateContextin the specified event argument which is an instance of a classsupports(Class)returnstruefor.- Parameters:
eventArg- the event argument.context- theStateContextto be stored.
-
supports
Must returntruefor anyClassthat thisStateContextLookupcan use to store and lookupStateContextobjects.- Parameters:
c- the class.- Returns:
trueorfalse.
-