java.lang.Object | +--javax.activation.CommandInfo
The CommandInfo class is used by CommandMap implementations to describe the results of command requests. It provides the requestor with both the verb requested, as well as an instance of the bean. There is also a method that will return the name of the class that implements the command butit is not guaranteed to return a valid value. The reason for this is to allow CommandMap implmentations that subclass CommandInfo to provide special behavior. For example a CommandMap could dynamically generate JavaBeans. In this case, it might not be possible to create an object with all the correct state information solely from the class name.
CommandInfo(java.lang.String verb, java.lang.String className) The Constructor for CommandInfo. |
getCommandClass() Return the command's class name. | |
getCommandName() Return the command verb. | |
getCommandObject(DataHandler dh, java.lang.ClassLoader loader) Return the instantiated JavaBean component. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
publicCommandInfo(java.lang.String verb, java.lang.String className)
verb
- The command verb this CommandInfo decribes.className
- The command's fully qualified class name.public java.lang.StringgetCommandName()
public java.lang.StringgetCommandClass()
public java.lang.ObjectgetCommandObject(DataHandler dh, java.lang.ClassLoader loader) throws java.io.IOException, java.lang.ClassNotFoundException
Begin by instantiating the component withBeans.instantiate()
.
If the bean implements thejavax.activation.CommandObject
interface, call itssetCommandContext
method.
If the DataHandler parameter is null, then the bean is instantiated with no data. NOTE: this may be useful if for some reason the DataHandler that is passed in throws IOExceptions when this method attempts to access its InputStream. It will allow the caller to retrieve a reference to the bean if it can be instantiated.
If the bean does NOT implement the CommandObject interface, this method will check if it implements the java.io.Externalizable interface. If it does, the bean's readExternal method will be called if an InputStream can be acquired from the DataHandler.
dh
- The DataHandler that describes the data to bepassed to the command.loader
- The ClassLoader to be used to instantiate the bean.Beans.instantiate(java.lang.ClassLoader, java.lang.String)
,CommandObject