I
- Instruction—the specific subtype of Instruction
we deal withC
- Context—The type of Object which holds information that an implementation needs for
actually executing instructions.public abstract class AbstractInstructionExecutor<I extends Instruction,C> extends Object implements InstructionExecutor<C>
Instruction
Modifier | Constructor and Description |
---|---|
protected |
AbstractInstructionExecutor(Class<I> instructionClass) |
Modifier and Type | Method and Description |
---|---|
boolean |
canExecute(Instruction instruction,
C context)
Indicates whether or not this instance is able to execute the given
Instruction , using
the given context object where necessary. |
protected boolean |
canExecuteSpecific(I instruction,
C context)
Template method for implementors.
|
void |
execute(Instruction instruction,
C context)
Perform that which is described by the given
Instruction . |
protected abstract void |
executeSpecific(I instruction,
C context)
Template method for implementors.
|
boolean |
pertainsTo(Class<? extends Instruction> clazz)
Returns whether or not this
InstructionExecutor knows how to deal with a given type of
Instruction . |
public boolean pertainsTo(Class<? extends Instruction> clazz)
InstructionExecutor
InstructionExecutor
knows how to deal with a given type of
Instruction
.pertainsTo
in interface InstructionExecutor<C>
clazz
- the type of Instruction
for which information is requestedtrue
if this InstructionExecutor
is able to handle
Instruction
s of the given type, false
otherwise.public final boolean canExecute(Instruction instruction, C context)
InstructionExecutor
Instruction
, using
the given context object where necessary.canExecute
in interface InstructionExecutor<C>
instruction
- the instruction in questioncontext
- holds additional, implementation-specific informationtrue
if this instance is able to execute the given Instruction
using the given context object where necessary; false
otherwise.protected boolean canExecuteSpecific(I instruction, C context)
Instruction
, using the given context object where necessary. The default
implementation does nothing and returns true
.instruction
- the instruction in question. It is guaranteed to be non-null
.context
- holds additional, implementation-specific informationtrue
if this instance is able to execute the given Instruction
using the given context object where necessary; false
otherwise.public final void execute(Instruction instruction, C context)
InstructionExecutor
Instruction
.execute
in interface InstructionExecutor<C>
instruction
- holds the information which specifies what to performcontext
- holds additional, implementation-specific informationprotected abstract void executeSpecific(I instruction, C context)
Instruction
.instruction
- holds the information which specifies what to perform. This
Instruction
is guaranteed to be non-null
.context
- holds additional, implementation-specific informationCopyright © 2024 levigo holding gmbh. All rights reserved.