projects
/
cli-helper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add Javadoc comments to enhance code clarity
[cli-helper.git]
/
src
/
main
/
java
/
eu
/
svjatoslav
/
commons
/
cli_helper
/
parameter_parser
/
parameter
/
DirectoryOptions.java
diff --git
a/src/main/java/eu/svjatoslav/commons/cli_helper/parameter_parser/parameter/DirectoryOptions.java
b/src/main/java/eu/svjatoslav/commons/cli_helper/parameter_parser/parameter/DirectoryOptions.java
index
2632174
..
d012cf9
100755
(executable)
--- a/
src/main/java/eu/svjatoslav/commons/cli_helper/parameter_parser/parameter/DirectoryOptions.java
+++ b/
src/main/java/eu/svjatoslav/commons/cli_helper/parameter_parser/parameter/DirectoryOptions.java
@@
-11,14
+11,32
@@
import java.io.File;
import java.util.List;
import java.util.stream.Collectors;
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> {
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;
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);
}
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) {
@Override
public String describeFormat() {
switch (existenceType) {
@@
-31,6
+49,11
@@
public class DirectoryOptions extends Option<List<File>, DirectoryOptions> {
}
}
}
}
+ /**
+ * 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());
@Override
public List<File> getValue() {
return parameters.stream().map(File::new).collect(Collectors.toList());
@@
-46,6
+69,7
@@
public class DirectoryOptions extends Option<List<File>, DirectoryOptions> {
return this;
}
return this;
}
+
@Override
public boolean isValid(final String value) {
final File file = new File(value);
@Override
public boolean isValid(final String value) {
final File file = new File(value);