import java.util.List;
import java.util.stream.Collectors;
+/**
+ * DirectoryOptions class represents a command-line option for one or more directories.
+ */
public class DirectoryOptions extends Option<List<File>, DirectoryOptions> {
+ /**
+ * This enum is used to define if resource denoted by particular option parameter shall exist or not.
+ * <p>
+ * This allows to specify for example if directory shall exist or not.
+ */
private ExistenceType existenceType = ExistenceType.DOES_NOT_MATTER;
+ /**
+ * Creates a new DirectoryOptions object with the given description.
+ *
+ * @param description The description of the directory options.
+ */
public DirectoryOptions(final String description) {
super(description, ParameterCount.ONE_OR_MORE);
}
+ /**
+ * Returns a string describing the format of the option.
+ *
+ * @return A string describing the format of the option.
+ */
@Override
public String describeFormat() {
switch (existenceType) {
}
}
+ /**
+ * Returns the value of the option as a list of File objects.
+ *
+ * @return The value of the option as a list of File objects.
+ */
@Override
public List<File> getValue() {
return parameters.stream().map(File::new).collect(Collectors.toList());
return this;
}
+
@Override
public boolean isValid(final String value) {
final File file = new File(value);