public class RemoveMappingCommand extends AbstractCommand
MappingDomain
from a set of the domain's input and output objects.AbstractCommand.NonDirtying
Modifier and Type | Field and Description |
---|---|
protected java.util.Collection<?> |
collection
This keeps track of the input and output objects that are to be mapped.
|
protected static java.lang.String |
DESCRIPTION
This cachaes the description.
|
protected MappingDomain |
domain
This keeps track of the mapping domain in which the command operates.
|
protected static java.lang.String |
LABEL
This caches the label.
|
description, isExecutable, isPrepared, label
Constructor and Description |
---|
RemoveMappingCommand(MappingDomain domain,
java.util.Collection<?> collection)
This creates a command instance that removes the mappings in the collection from the mapping root.
|
Modifier and Type | Method and Description |
---|---|
static Command |
create(MappingDomain domain,
java.util.Collection<?> collection)
This creates a command that removes the mappings in the collection from the mapping root.
|
static Command |
create(MappingDomain domain,
Mapping mapping)
This creates a command that removes the mapping from the mapping root.
|
void |
dispose()
Called to indicate that the command will never be used again.
|
void |
execute()
Performs the command activity required for the effect.
|
java.util.Collection<?> |
getResult()
Returns an empty list.
|
protected boolean |
prepare()
Called at most once in
AbstractCommand.canExecute() to give the command an opportunity to ready itself for execution. |
void |
redo()
Performs the command activity required to
redo the effect after undoing the effect. |
java.lang.String |
toString()
This gives an abbreviated name using this object's own class' name, without package qualification,
followed by a space separated list of field:value pairs.
|
void |
undo()
Throws a runtime exception.
|
canExecute, canUndo, chain, getAffectedObjects, getDescription, getLabel, setDescription, setLabel
protected static final java.lang.String LABEL
protected static final java.lang.String DESCRIPTION
protected MappingDomain domain
protected java.util.Collection<?> collection
public RemoveMappingCommand(MappingDomain domain, java.util.Collection<?> collection)
public static Command create(MappingDomain domain, Mapping mapping)
public static Command create(MappingDomain domain, java.util.Collection<?> collection)
protected boolean prepare()
AbstractCommand
AbstractCommand.canExecute()
to give the command an opportunity to ready itself for execution.
The returned value is stored in AbstractCommand.canExecute()
.
In other words, you can override this method to initialize
and to yield a cached value for the all subsequent calls to canExecute.prepare
in class AbstractCommand
public void execute()
Command
execute
when canExecute
returns false
,
or when canExecute
hasn't been called, is undefined.public void undo()
AbstractCommand
undo
in interface Command
undo
in class AbstractCommand
public void redo()
Command
redo
the effect after undoing the effect.
The effect, if any, of calling redo
before undo
is called is undefined.
Note that if you implement redo
to call execute
then any derived class will be restricted by that decision also.public java.util.Collection<?> getResult()
AbstractCommand
getResult
in interface Command
getResult
in class AbstractCommand
public void dispose()
Command
dispose
in interface Command
dispose
in class AbstractCommand
public java.lang.String toString()
toString
in class AbstractCommand