C
- Context—The type of Object which holds information that an implementation needs for
actually executing instructions.public interface InstructionExecutor<C>
Instruction
. InstructionExecutor
s have the ability to carry out an
Instruction
's aims, applying its key data to given context objects.
At first glance the method signatures resemble those of Command
s. While there are some
similarities, InstructionExecutor
s represent a more general approach that has no
dependencies to Swing or even any GUI concepts.
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. |
void |
execute(Instruction instruction,
C context)
Perform that which is described by the given
Instruction . |
boolean |
pertainsTo(Class<? extends Instruction> clazz)
Returns whether or not this
InstructionExecutor knows how to deal with a given type of
Instruction . |
boolean pertainsTo(Class<? extends Instruction> clazz)
InstructionExecutor
knows how to deal with a given type of
Instruction
.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.boolean canExecute(Instruction instruction, C context)
Instruction
, using
the given context object where necessary.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.void execute(Instruction instruction, C context)
Instruction
.instruction
- holds the information which specifies what to performcontext
- holds additional, implementation-specific informationCopyright © 2024 levigo holding gmbh. All rights reserved.