Package com.j3d.engine.interact.cmd.args
Class TypedArg
java.lang.Object
com.j3d.engine.interact.cmd.args.TypedArg
- All Implemented Interfaces:
Argument
Represents a command argument that is expected to be of a specific type or one of several allowed types.
This class is used to define arguments that require type validation. For example, an argument
might be required to be a Double, a String, or a specific graphics object like a GPoint.
This information is crucial for both parsing user input and for auto-generating accurate command usage strings.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
type
A list ofClassobjects representing the allowed types for this argument. -
name
-
description
-
optional
private final boolean optional
-
-
Constructor Details
-
TypedArg
Constructs a new TypedArg.- Parameters:
name- The name of the argument.description- A user-friendly description of the argument's purpose.optional-trueif the argument is optional,falseif it is required.type- A varargs array ofClassobjects representing the allowed types.
-
-
Method Details
-
getType
Returns the list of allowed types for this argument. -
getName
Description copied from interface:ArgumentReturns the name of the argument.This is the identifier used by the command parser to refer to this argument.
-
getDescription
Description copied from interface:ArgumentProvides a user-friendly description of what the argument does.This is typically used for generating help text or tooltips.
- Specified by:
getDescriptionin interfaceArgument- Returns:
- A brief description of the argument's purpose.
-
isOptional
public boolean isOptional()Description copied from interface:ArgumentSpecifies whether the argument is optional or required for the command to execute.- Specified by:
isOptionalin interfaceArgument- Returns:
trueif the argument is optional,falseif it is required.
-