Package tools.ToolClasses
Interface ArgumentEnum
- All Known Implementing Classes:
Main.ARGUMENTS
public interface ArgumentEnum
ArgumentEnum
An interface that represents an enum that defines arguments for anArgumentedTool.
Each enum constant represents an argument. It must specify the following:
- ArgumentType: The type of the argument. This takes in a class and is used to parse the raw string argument into the correct type. Supported types are:
- DefaultValue: The default value for the argument. This is used if the argument is missing or fails to parse. Can be null.
- Description: A description of the argument. This is used for documentation purposes.
Example usage:
public enum ARGUMENTS implements ArgumentEnum {
TIMEOUT(Integer.class, 30, "Timeout in seconds"),
VERBOSE(Boolean.class, false, "Enable verbose logging"),
private final Class<?> argumentType;
private final Object defaultValue;
private final String description;
ARGUMENTS(Class<?> argumentType, Object defaultValue, String description) {
this.argumentType = argumentType;
this.defaultValue = defaultValue;
this.description = description;
}
@Override
public Class<?> getArgumentType() { return argumentType; }
@Override
public Object getDefaultValue() { return defaultValue; }
@Override
public String getDescription() { return description; }
}
-
Method Summary
Modifier and TypeMethodDescriptionClass<?>Gets the argument type.Gets the default value for the argument.Gets the description of the argument.
-
Method Details
-
getArgumentType
Class<?> getArgumentType()Gets the argument type.- Returns:
- the argument type
-
getDefaultValue
Gets the default value for the argument. This is used if the argument is missing or fails to parse. Can be null.- Returns:
- the default value
-
getDescription
Gets the description of the argument. This is used for documentation purposes.- Returns:
- the description
-