public class TargetPolicyDefault extends java.lang.Object implements TargetPolicy, java.io.Serializable
The TargetPolicyDefault class allows a client to set the target of a command in several ways:
The getCommandTarget() method implements the following ordered steps for determining the target that to be returned for a given command. The getCommandTarget() method stops when it finds a target.
The class sets the default target name to the LocalTarget class.
Constructor and Description |
---|
TargetPolicyDefault() |
Modifier and Type | Method and Description |
---|---|
CommandTarget |
getCommandTarget(TargetableCommand command)
The getCommandTarget() method implements the method in the TargetPolicy
interface.
|
java.util.Dictionary |
listMappings()
Lists all the command-to-target mappings.
|
void |
registerCommand(java.lang.String commandBeanName,
java.lang.String targetBeanName)
Registers a single command-to-target mapping.
|
void |
setDefaultTargetName(java.lang.String defaultTargetName)
Sets the default target name, used if no other target is found.
|
void |
unregisterCommand(java.lang.String commandBeanName)
Unregisters a single command-to-target mapping.
|
public CommandTarget getCommandTarget(TargetableCommand command)
getCommandTarget
in interface TargetPolicy
command
- The TargetableCommand whose CommandTarget is needed.public java.util.Dictionary listMappings()
public void registerCommand(java.lang.String commandBeanName, java.lang.String targetBeanName)
commandBeanName
- The name of the command.targetBeanName
- The name of the target.public void setDefaultTargetName(java.lang.String defaultTargetName)
defaultTargetName
- The name of the default target.public void unregisterCommand(java.lang.String commandBeanName)
commandBeanName
- The name of the command.