Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS

Class javax.activation.CommandInfo

java.lang.Object
    |
    +----javax.activation.CommandInfo

public class CommandInfo
extends java.lang.Object
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 method that will return the class name of the class that implements the command but it is not guaranteed to return a valid value. The reason for this is to allow CommandMap implmentations to 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.


Constructor Summary
 CommandInfo(java.lang.String verb, java.lang.String className)
The Constructor for CommandInfo
 

Method Summary
java.lang.String  getCommandClass()
Return the command's class name.
java.lang.String  getCommandName()
Return the command verb.
java.lang.Object  getCommandObject(DataHandler dh, java.lang.ClassLoader loader)
Return the instansiated JavaBean.
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandInfo

public CommandInfo(java.lang.String verb,
                   java.lang.String className)
The Constructor for CommandInfo
Parameters:
verb - The command verb this CommandInfo Decribes.
className - The Bean's fully qualified class name.
Method Detail

getCommandName

public java.lang.String getCommandName()
Return the command verb.
Returns:
the command verb.

getCommandClass

public java.lang.String getCommandClass()
Return the command's class name. This method MAY return null in cases where a CommandMap sub classed CommandInfo for it's own purposes. In other words, it might not be possible to create the correct state in the command by merely knowing it's class name. DO NOT DEPEND ON THIS METHOD RETURNING A VALID VALUE!
Returns:
The class name of the command, or null

getCommandObject

public java.lang.Object getCommandObject(DataHandler dh,
                               java.lang.ClassLoader loader) throws java.io.IOException, java.lang.ClassNotFoundException
Return the instansiated JavaBean.

Begin by instantiating the Bean with Beans.instantiate().

If this bean implements the javax.activation.CommandObject interface, call it's setCommandContext method.

If the DataHandler parameter is null, then the class 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 it's 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.

Parameters:
dh - The DataHandler that describes the data to be passed to the command.
loader - The ClassLoader to be used to instansiate the Bean.
Returns:
The Bean
See Also:
instantiate, CommandObject

Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS