import static java.util.Collections.addAll;
import static java.util.stream.Collectors.joining;
+/**
+ * Represents an option that can be provided on CLI.
+ * This class allows specifying whether the option is mandatory,
+ * the parameter count, a description, and any aliases for the option.
+ *
+ * @param <T> type of value that this option returns.
+ * @param <I> type of this option.
+ */
public abstract class Option<T, I extends Option> {
/**
*/
private boolean isPresent;
+ /**
+ * Represents an option that can be provided on CLI.
+ * This class allows specifying whether the option is mandatory,
+ * the parameter count, a description, and any aliases for the option.
+ *
+ * @param mandatory indicates whether the option is mandatory
+ * @param parameterCount the number of parameters required for the option
+ * @param description a description of the option
+ * @param aliases2 any additional aliases for the option
+ */
public Option(final boolean mandatory,
final ParameterCount parameterCount, final String description,
final String... aliases2) {
this.parameterCount = parameterCount;
}
+ /**
+ * Adds additional aliases to the option.
+ *
+ * @param aliasArray an array of strings representing the aliases to be added
+ * @return the modified option object
+ */
@SuppressWarnings("unchecked")
public I addAliases(final String... aliasArray) {
}
/**
- * @return help for this option.
+ * Returns the help message for this parameter.
+ *
+ * @return the help message as a string.
*/
public String getHelp() {
final StringBuilder result = new StringBuilder();
return result.toString();
}
+ /**
+ * Returns the value of the object.
+ *
+ * @return the value of the object.
+ */
public abstract T getValue();
public boolean isMandatory() {
}
/**
- * @return the parameterSpecified
+ * @return <code>true</code> if this parameter was present in the commandline.
*/
public boolean isPresent() {
return isPresent;
}
/**
- * @param present the parameterSpecified to set
+ * Sets the present status of this parameter.
+ *
+ * @param present <code>true</code> if this parameter is present in the command line,
+ * <code>false</code> otherwise.
*/
protected void setPresent(final boolean present) {
this.isPresent = present;
return true;
}
+ /**
+ * Sets the option as mandatory. This means that the option must be provided by the user
+ * in order for the program to run successfully.
+ *
+ * @return The updated instance of the option.
+ */
@SuppressWarnings("unchecked")
public I setMandatory() {
mandatory = true;