R
- The return typeD
- The data type held by the hostP
- The input parameter typepublic abstract class ADataPacketAlgoCmd<R,D,P> extends java.lang.Object implements IExtVisitorCmd<R,java.lang.Class<?>,P,ADataPacket>
myDataPacketAlgo.addCmd(MyData.class, new ADataPacketAlgoCmd<MyReturn, MyData, MyParam>(){ private static final long serialVersionUID = aGeneratedUIDvalue; public MyReturn apply(DataPacket<MyData> host, MyParam... params){ // your code here } }Note: In Eclipse, the auto-generation of the implemented methods of this class does not work properly. The concrete apply method below is replicated by the automatic method generator because it doesn't recognize that the method already exists and is final. Luckily, a compiler error message gets generated in the attempt to override a final method. Simply delete the extraneous auto-generated method.
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID |
Constructor and Description |
---|
ADataPacketAlgoCmd() |
Modifier and Type | Method and Description |
---|---|
abstract R |
apply(java.lang.Class<?> index,
DataPacket<D> host,
P... params)
Abstract method that actually performs the processing of the case.
|
<T extends IExtVisitorHost<java.lang.Class<?>,? super ADataPacket>> |
apply(java.lang.Class<?> index,
T host,
P... params)
The actual method called by the host visitor when the associated case is invoked.
|
abstract void |
setCmd2ModelAdpt(ICmd2ModelAdapter cmd2ModelAdpt)
Sets the ICmd2ModelAdapter for this command to use to communicate with the
local ChatApp host system.
|
private static final long serialVersionUID
public final <T extends IExtVisitorHost<java.lang.Class<?>,? super ADataPacket>> R apply(java.lang.Class<?> index, T host, P... params)
apply
in interface IExtVisitorCmd<R,java.lang.Class<?>,P,ADataPacket>
T
- The type of the host the is expected to call this method. T is restricted to be a subclass of IExtVisitorHost<I, ? super H>index
- The Class object used to identify the hosthost
- The host calling the visitorparams
- Vararg input parameters to be used for processing the hostpublic abstract R apply(java.lang.Class<?> index, DataPacket<D> host, P... params)
index
- The host ID identifying the hosthost
- The DataPacket host calling the visitorparams
- Vararg input parameter to be used for processing the hostpublic abstract void setCmd2ModelAdpt(ICmd2ModelAdapter cmd2ModelAdpt)
cmd2ModelAdpt
- The adapter to the ChatApp model.