public abstract class Filter
extends java.lang.Object
accept()
method and postProcess
methods are invoked; Filters in the filter chain are nested.
The accept()
method is called before the command is
processed by successive filters in the chain. It should be used
to take proper actions before the command consumption. On the other hand
the postProcess()
method is called after the command
has been processed by successive filters in the chain. It should be used
to take proper actions after the command consumption.jade.core.CommandProcessor
Modifier and Type | Field and Description |
---|---|
static int |
FIRST
The constant indicating the first position in the filter chain
|
static boolean |
INCOMING
A constant indicating a filter for incoming commands
|
static int |
LAST
The constant indicating the last position in the filter chain
|
static boolean |
OUTGOING
A constant indicating a filter for outgoing commands
|
Constructor and Description |
---|
Filter() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
accept(VerticalCommand cmd)
Process a command before it is processed by successive
filters in the filter-chain.
|
int |
getPreferredPosition()
Retrieve the preferred position for this filter in the filter chain
|
boolean |
isBlocking()
Inquires the blocking state of this filter.
|
boolean |
isSkipping()
Inquires the skipping state of this filter.
|
protected void |
postProcess(VerticalCommand cmd)
Post-process a command object after it has been processed by the
successive filters in the filter chain.
|
void |
setBlocking(boolean newState)
Sets the blocking state of this filter.
|
void |
setPreferredPosition(int pos)
Sets the preferred position for this filter in the filter chain
|
void |
setSkipping(boolean newState)
Sets the skipping state of this filter.
|
public static final int FIRST
public static final int LAST
public static final boolean INCOMING
public static final boolean OUTGOING
protected boolean accept(VerticalCommand cmd)
cmd
- A VerticalCommand
describing what operation has
been requested from previous layers (that can be the actual
prime source of the command or previous filters in the chain).false
from this method. A vetoed command
is not propagated in the filter chain.protected void postProcess(VerticalCommand cmd)
cmd
- A VerticalCommand
describing what operation has
been requested from previous layers (that can be the actual
prime source of the command or previous filters in the chain).public final int getPreferredPosition()
public final void setPreferredPosition(int pos)
public void setBlocking(boolean newState)
newState
- The boolean value to set the blocking state to.public boolean isBlocking()
public void setSkipping(boolean newState)
blocked
- The boolean value to set the skipping state to.public boolean isSkipping()