Class CommandInfo
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the command's class name.Return the command verb.getCommandObject
(DataHandler dh, ClassLoader loader) Return the instantiated JavaBean component.
-
Constructor Details
-
CommandInfo
The Constructor for CommandInfo.- Parameters:
verb
- The command verb this CommandInfo decribes.className
- The command's fully qualified class name.
-
-
Method Details
-
getCommandName
Return the command verb.- Returns:
- the command verb.
-
getCommandClass
Return the command's class name. This method MAY return null in cases where a CommandMap subclassed CommandInfo for its own purposes. In other words, it might not be possible to create the correct state in the command by merely knowing its class name. DO NOT DEPEND ON THIS METHOD RETURNING A VALID VALUE!- Returns:
- The class name of the command, or null
-
getCommandObject
public Object getCommandObject(DataHandler dh, ClassLoader loader) throws IOException, ClassNotFoundException Return the instantiated JavaBean component.If the current runtime environment supports
Beans.instantiate
, use it to instantiate the JavaBeans component. Otherwise, useClass.forName
.The component class needs to be public. On Java SE 9 and newer, if the component class is in a named module, it needs to be in an exported package.
If the bean implements the
jakarta.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.
- Parameters:
dh
- The DataHandler that describes the data to be passed to the command.loader
- The ClassLoader to be used to instantiate the bean.- Returns:
- The bean
- Throws:
IOException
- for failures reading dataClassNotFoundException
- if command object class can't be found- See Also:
-