R - the class type of the subclass@SkipAnnotation(value=false) public abstract class AbstractWaveReady<R extends WaveReady<R>> extends AbstractReady<R> implements WaveReady<R>, LinkMessages
| Modifier and Type | Field and Description |
|---|---|
private Map<String,List<Method>> |
lifecycleMethod
A map that store all annotated methods to call sorted by lifecycle phase.
|
private static JRLogger |
LOGGER
The class logger.
|
static String |
PROCESS_WAVE_METHOD_NAME
The default fallback wave handle method.
|
private Map<WaveType,Class<? extends Command>> |
returnCommandClass
The return command class map.
|
private Map<WaveType,WaveType> |
returnWaveTypeMap
The return wave type map.
|
CALL_ANNOTATED_METHOD_ERROR, COMMAND_NOT_FOUND_ERROR, COMMAND_NOT_FOUND_MESSAGE, COMPONENT_INJECTION_FAILURE, CUSTOM_METHOD_NOT_FOUND, LISTEN_WAVE_TYPE, MODEL_NOT_FOUND_ERROR, MODEL_NOT_FOUND_MESSAGE, NO_WAVE_LISTENER, NOTIFIER_CONSUMES, SEND_WAVE, SERVICE_NOT_FOUND_ERROR, SERVICE_NOT_FOUND_MESSAGE, UNLISTEN_WAVE_TYPE, USE_DEFAULT_WAVE_HANDLER, WAVE_BEAN_CREATION_ERROR, WAVE_DISPATCH_ERROR, WAVE_HANDLING_ERROR, WAVE_LOST, WAVE_LOST_CONTEXT, WAVE_SENDING_ERROR| Constructor and Description |
|---|
AbstractWaveReady() |
| Modifier and Type | Method and Description |
|---|---|
Wave |
attachUi(Class<? extends Model> modelClass,
WaveData<?>... data)
Send a wave used to display an UI model.
|
private void |
callAnnotatedMethod(Class<? extends Annotation> annotationClass)
Call annotated methods corresponding at given lifecycle annotation.
|
Wave |
callCommand(Class<? extends Command> commandClass,
WaveData<?>... data)
Send a wave used to call a command.
|
<WB extends WaveBean> |
callCommand(Class<? extends CommandBean<WB>> commandClass,
WB waveBean)
Send a wave used to call a command.
|
private Wave |
createWave(WaveGroup waveGroup,
WaveType waveType,
Class<?> relatedClass,
WaveBean waveBean)
Build a wave object with its dedicated WaveBean.
|
private Wave |
createWave(WaveGroup waveGroup,
WaveType waveType,
Class<?> relatedClass,
WaveData<?>... waveData)
Build a wave object.
|
private Notifier |
getNotifier()
Short cut method used to retrieve the notifier.
|
Class<? extends Command> |
getReturnCommand(WaveType waveType)
Return the return Command to call for given wave type.
|
WaveType |
getReturnWaveType(WaveType waveType)
Return the return wave type.
|
private WaveReady<?> |
getWaveReady()
Private method used to grab the right WaveType
|
private String |
getWaveTypesString(WaveType[] waveTypes)
Return the human-readable list of Wave Type.
|
void |
listen(WaveChecker waveChecker,
Method method,
WaveType... waveTypes)
Begin to listen the type of wave for the current component.
|
void |
listen(WaveChecker waveChecker,
WaveType... waveTypes)
Begin to listen the type of wave for the current component.
|
void |
listen(WaveType... waveTypes)
Begin to listen the type of wave for the current component.
|
protected abstract void |
processWave(Wave wave)
Process the wave.
|
protected abstract void |
ready()
The component is now ready to do custom initialization tasks.
|
void |
registerCallback(WaveChecker waveChecker,
WaveType callType,
WaveType responseType,
Class<? extends Command> returnCommandClass)
Register a wave call back contract.
|
void |
registerCallback(WaveType callType,
WaveType responseType)
Register a wave call back contract.
|
void |
registerCallback(WaveType callType,
WaveType responseType,
Class<? extends Command> returnCommandClass)
Register a wave call back contract.
|
void |
release()
Release the component by deleting this key used by the WeakHashMap.
|
Wave |
returnData(Class<? extends Service> serviceClass,
WaveType waveType,
WaveData<?>... data)
Send a wave used to return data from a service.
|
void |
sendWave(Wave wave)
Send a wave to the notifier.
|
Wave |
sendWave(WaveType waveType,
WaveData<?>... waveData)
Send a wave to the notifier.
|
private Wave |
sendWaveIntoJit(Wave wave)
Send the given wave using the JRebirth Thread.
|
void |
setup()
Launch the initialization of the component.
|
void |
unlisten(WaveType... waveTypes)
Stop to listen the type of wave for the current component.
|
getCommand, getFirstKeyPart, getKey, getListKeyPart, getLocalFacade, getModel, getSecondKeyPart, getService, getThirdKeyPart, setKey, setLocalFacadeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetKey, getLocalFacade, setKey, setLocalFacadegetModelgetServicegetCommandpublic static final String PROCESS_WAVE_METHOD_NAME
private static final JRLogger LOGGER
private final Map<WaveType,Class<? extends Command>> returnCommandClass
private Notifier getNotifier()
public final void listen(WaveType... waveTypes)
org.jrebirth.af.core.resource.provided.JRebirthParameters.DEVELOPER_MODE parameter is truepublic final void listen(WaveChecker waveChecker, WaveType... waveTypes)
org.jrebirth.af.core.resource.provided.JRebirthParameters.DEVELOPER_MODE parameter is true
The wave checker is used to filter the wave if the checker returns falseprivate String getWaveTypesString(WaveType[] waveTypes)
waveTypes - the list of wave typepublic final void listen(WaveChecker waveChecker, Method method, WaveType... waveTypes)
org.jrebirth.af.core.resource.provided.JRebirthParameters.DEVELOPER_MODE parameter is true
The wave checker is used to filter the wave if the checker returns falsepublic final void registerCallback(WaveType callType, WaveType responseType)
org.jrebirth.af.core.resource.provided.JRebirthParameters.DEVELOPER_MODE parameter is trueregisterCallback in interface WaveReady<R extends WaveReady<R>>callType - the wave type mapped to this service.responseType - the wave type of the wave emitted in returnpublic final void registerCallback(WaveType callType, WaveType responseType, Class<? extends Command> returnCommandClass)
org.jrebirth.af.core.resource.provided.JRebirthParameters.DEVELOPER_MODE parameter is trueregisterCallback in interface WaveReady<R extends WaveReady<R>>callType - the wave type mapped to this service.responseType - the wave type of the wave emitted in returnreturnCommandClass - the command class to call to process the service resultpublic final void registerCallback(WaveChecker waveChecker, WaveType callType, WaveType responseType, Class<? extends Command> returnCommandClass)
org.jrebirth.af.core.resource.provided.JRebirthParameters.DEVELOPER_MODE parameter is trueregisterCallback in interface WaveReady<R extends WaveReady<R>>waveChecker - the wave checker used to forward the wave only if the checker return truecallType - the wave type mapped to this service.responseType - the wave type of the wave emitted in returnreturnCommandClass - the command class to call to process the service resultpublic final WaveType getReturnWaveType(WaveType waveType)
getReturnWaveType in interface WaveReady<R extends WaveReady<R>>waveType - the source wave typepublic final Class<? extends Command> getReturnCommand(WaveType waveType)
getReturnCommand in interface WaveReady<R extends WaveReady<R>>waveType - the source wave typepublic final void unlisten(WaveType... waveTypes)
public final void sendWave(Wave wave)
public final Wave sendWave(WaveType waveType, WaveData<?>... waveData)
public final <WB extends WaveBean> Wave callCommand(Class<? extends CommandBean<WB>> commandClass, WB waveBean)
callCommand in interface CommandReadyWB - the type of the wave bean to usedcommandClass - the command class to callwaveBean - the WaveBean that holds all required wave datapublic final Wave callCommand(Class<? extends Command> commandClass, WaveData<?>... data)
callCommand in interface CommandReadycommandClass - the command class to calldata - the data to transportpublic final Wave returnData(Class<? extends Service> serviceClass, WaveType waveType, WaveData<?>... data)
returnData in interface ServiceReadyserviceClass - the service calledwaveType - the type of the wavedata - the data to transportpublic final Wave attachUi(Class<? extends Model> modelClass, WaveData<?>... data)
attachUi in interface ModelReadymodelClass - the model class to displaydata - the data to transportprivate Wave sendWaveIntoJit(Wave wave)
wave - the wave to sendprivate Wave createWave(WaveGroup waveGroup, WaveType waveType, Class<?> relatedClass, WaveData<?>... waveData)
waveGroup - the group of the wavewaveType - the type of the waverelatedClass - the related class if anywaveData - wave data to useprivate Wave createWave(WaveGroup waveGroup, WaveType waveType, Class<?> relatedClass, WaveBean waveBean)
waveGroup - the group of the wavewaveType - the type of the waverelatedClass - the related class if anywaveBean - the wave bean that holds all required wave dataprotected abstract void processWave(Wave wave)
wave - the wave receivedpublic void setup()
throws CoreException
setup in interface FacadeReady<R extends WaveReady<R>>CoreException - if the initialization failspublic void release()
release in interface FacadeReady<R extends WaveReady<R>>private WaveReady<?> getWaveReady()
private void callAnnotatedMethod(Class<? extends Annotation> annotationClass)
annotationClass - the annotation related to the lifecycleprotected abstract void ready()
throws CoreException
CoreException - if an error occurredCopyright © 2011–2014 JRebirth OSS. All rights reserved.