public final class FindArguments extends Object implements Arguments<FindArguments>
find command.| Constructor and Description |
|---|
FindArguments()
Constructor to use if no options are specified.
|
FindArguments(FindOptions options)
Constructor with option set containing the selected command options.
|
FindArguments(String... args)
Constructor string arguments encoding options and arguments, possibly
also containing variable expressions.
|
| Modifier and Type | Method and Description |
|---|---|
String[] |
getArgs()
Returns the
<args> operand value: String arguments defining the options and operands for the command. |
FindArguments |
getForContext(ExecutionContext context)
Returns an arguments object for the given execution context with resolved
variables if necessary and possible.
|
String |
getName()
Returns the
<name> operand value (variables are NOT resolved): Name pattern to match the file name after removing the path with the
leading directories; wildcards * and ? are supported, or full
regular expressions if either of the options -regex (-r) or
-iregex (-i) is specified. |
String |
getName(ExecutionContext context)
Returns the
<name> (variables are resolved): Name pattern to match the file name after removing the path with the
leading directories; wildcards * and ? are supported, or full
regular expressions if either of the options -regex (-r) or
-iregex (-i) is specified. |
FindOptions |
getOptions()
Returns the options set containing the selected command options.
|
String |
getPath()
Returns the
<path> operand value (variables are NOT resolved): Starting point for the search in the directory hierarchy;
wildcards * and ? are supported; relative paths are resolved on the
basis of the current working directory. |
String |
getPath(ExecutionContext context)
Returns the
<path> (variables are resolved): Starting point for the search in the directory hierarchy;
wildcards * and ? are supported; relative paths are resolved on the
basis of the current working directory. |
long |
getSize()
Returns the
<size> operand value: Consider only files using at least size bytes if size
is positive, or at most abs(size) bytes if size is zero
or negative. |
Date |
getTime()
Returns the
<time> operand value: Consider only files that have been created, modified or accessed
before or after the specified time operand; consider the
-time... options for details of the comparison. |
boolean |
isArgsSet()
Returns true if the
<args> operand has been set. |
boolean |
isIgnoreCase()
Returns true if the
--ignoreCase option
is set. |
boolean |
isNameSet()
Returns true if the
<name> operand has been set. |
boolean |
isPathSet()
Returns true if the
<path> operand has been set. |
boolean |
isPrint0()
Returns true if the
--print0 option
is set. |
boolean |
isRegex()
Returns true if the
--regex option
is set. |
boolean |
isSizeSet()
Returns true if the
<size> operand has been set. |
boolean |
isTimeAccess()
Returns true if the
--timeAccess option
is set. |
boolean |
isTimeCreate()
Returns true if the
--timeCreate option
is set. |
boolean |
isTimeModified()
Returns true if the
--timeModified option
is set. |
boolean |
isTimeNewer()
Returns true if the
--timeNewer option
is set. |
boolean |
isTimeOlder()
Returns true if the
--timeOlder option
is set. |
boolean |
isTimeSet()
Returns true if the
<time> operand has been set. |
boolean |
isTypeDirectory()
Returns true if the
--typeDirectory option
is set. |
boolean |
isTypeFile()
Returns true if the
--typeFile option
is set. |
boolean |
isTypeOther()
Returns true if the
--typeOther option
is set. |
boolean |
isTypeSymlink()
Returns true if the
--typeSymlink option
is set. |
void |
setName(String name)
Sets
<name>: Name pattern to match the file name after removing the path with the
leading directories; wildcards * and ? are supported, or full
regular expressions if either of the options -regex (-r) or
-iregex (-i) is specified. |
void |
setPath(String path)
Sets
<path>: Starting point for the search in the directory hierarchy;
wildcards * and ? are supported; relative paths are resolved on the
basis of the current working directory. |
void |
setSize(long size)
Sets
<size>: Consider only files using at least size bytes if size
is positive, or at most abs(size) bytes if size is zero
or negative. |
void |
setTime(Date time)
Sets
<time>: Consider only files that have been created, modified or accessed
before or after the specified time operand; consider the
-time... options for details of the comparison. |
String |
toString()
Returns a string representation of the command arguments and options.
|
public FindArguments()
public FindArguments(FindOptions options)
options - the selected optionsNullPointerException - if the argument is nullpublic FindArguments(String... args)
args - string arguments for the commandNullPointerException - if args is nullpublic FindOptions getOptions()
public FindArguments getForContext(ExecutionContext context)
Argumentsthis arguments instance is simply returned.
If variables are present, they are resolved if such a variable is defined
in the VariableContext returned by
context.getVariableContext().
Values are converted if necessary with the ValueConverters
returned by
context.getValueConverterFor(Class).
getForContext in interface Arguments<FindArguments>context - the execution context providing access to variables and
converterspublic String getPath()
<path> operand value (variables are NOT resolved): Starting point for the search in the directory hierarchy;
wildcards * and ? are supported; relative paths are resolved on the
basis of the current working directory.<path> operand value (variables are not resolved)IllegalStateException - if this operand has never been setgetPath(ExecutionContext)public String getPath(ExecutionContext context)
<path> (variables are resolved): Starting point for the search in the directory hierarchy;
wildcards * and ? are supported; relative paths are resolved on the
basis of the current working directory.context - the execution context used to resolve variables<path> operand value after resolving variablesIllegalStateException - if this operand has never been setgetPath()public boolean isPathSet()
<path> operand has been set.
Note that this method returns true even if null was passed to the
setPath(String) method.
<path> operand has
been called at least oncepublic void setPath(String path)
<path>: Starting point for the search in the directory hierarchy;
wildcards * and ? are supported; relative paths are resolved on the
basis of the current working directory.path - the value for the <path> operandpublic String getName()
<name> operand value (variables are NOT resolved): Name pattern to match the file name after removing the path with the
leading directories; wildcards * and ? are supported, or full
regular expressions if either of the options -regex (-r) or
-iregex (-i) is specified.<name> operand value (variables are not resolved)IllegalStateException - if this operand has never been setgetName(ExecutionContext)public String getName(ExecutionContext context)
<name> (variables are resolved): Name pattern to match the file name after removing the path with the
leading directories; wildcards * and ? are supported, or full
regular expressions if either of the options -regex (-r) or
-iregex (-i) is specified.context - the execution context used to resolve variables<name> operand value after resolving variablesIllegalStateException - if this operand has never been setgetName()public boolean isNameSet()
<name> operand has been set.
Note that this method returns true even if null was passed to the
setName(String) method.
<name> operand has
been called at least oncepublic void setName(String name)
<name>: Name pattern to match the file name after removing the path with the
leading directories; wildcards * and ? are supported, or full
regular expressions if either of the options -regex (-r) or
-iregex (-i) is specified.name - the value for the <name> operandpublic long getSize()
<size> operand value: Consider only files using at least size bytes if size
is positive, or at most abs(size) bytes if size is zero
or negative.<size> operand value (variables are not resolved)IllegalStateException - if this operand has never been setpublic boolean isSizeSet()
<size> operand has been set.
Note that this method returns true even if null was passed to the
setSize(long) method.
<size> operand has
been called at least oncepublic void setSize(long size)
<size>: Consider only files using at least size bytes if size
is positive, or at most abs(size) bytes if size is zero
or negative.size - the value for the <size> operandpublic Date getTime()
<time> operand value: Consider only files that have been created, modified or accessed
before or after the specified time operand; consider the
-time... options for details of the comparison.<time> operand value (variables are not resolved)IllegalStateException - if this operand has never been setpublic boolean isTimeSet()
<time> operand has been set.
Note that this method returns true even if null was passed to the
setTime(java.util.Date) method.
<time> operand has
been called at least oncepublic void setTime(Date time)
<time>: Consider only files that have been created, modified or accessed
before or after the specified time operand; consider the
-time... options for details of the comparison.time - the value for the <time> operandpublic String[] getArgs()
<args> operand value: String arguments defining the options and operands for the command.
Options can be specified by acronym (with a leading dash "-") or by
long name (with two leading dashes "--"). Operands other than the
default "--path" operand have to be prefixed with the operand name
(e.g. "--name" for subsequent path operand values).<args> operand value (variables are not resolved)IllegalStateException - if this operand has never been setpublic boolean isArgsSet()
<args> operand has been set.<args> operand has
been called at least oncepublic boolean isTypeDirectory()
--typeDirectory option
is set. The option is also known as -d option.
Description: Consider only directories
--typeDirectory or -d option is setpublic boolean isTypeFile()
--typeFile option
is set. The option is also known as -f option.
Description: Consider only regular files
--typeFile or -f option is setpublic boolean isTypeSymlink()
--typeSymlink option
is set. The option is also known as -l option.
Description: Consider only symbolic links
--typeSymlink or -l option is setpublic boolean isTypeOther()
--typeOther option
is set. The option is also known as -x option.
Description: Consider only files that are neither of directory (d), regular file (f) or symlink (l).
--typeOther or -x option is setpublic boolean isRegex()
--regex option
is set. The option is also known as -r option.
Description: Use full regular expression syntax for the patterns specified by the name operand
(This option is ignored if no name operand is specified).
--regex or -r option is setpublic boolean isIgnoreCase()
--ignoreCase option
is set. The option is also known as -i option.
Description: Use case insensitive matching when applying the file name pattern specified by the name operand
(This option is ignored if no name operand is specified).
--ignoreCase or -i option is setpublic boolean isTimeNewer()
--timeNewer option
is set. The option is also known as -n option.
Description: Consider only files that have been created, modified or accessed after or at the time specified by the time operand (the default)
(This option is ignored if no time operand is specified).
--timeNewer or -n option is setpublic boolean isTimeOlder()
--timeOlder option
is set. The option is also known as -o option.
Description: Consider only files that have been created, modified or accessed before or at the time specified by the time operand
(This option is ignored if no time operand is specified).
--timeOlder or -o option is setpublic boolean isTimeCreate()
--timeCreate option
is set. The option is also known as -c option.
Description: The time operand refers to the creation time of the file
(This option is ignored if no time operand is specified).
--timeCreate or -c option is setpublic boolean isTimeAccess()
--timeAccess option
is set. The option is also known as -a option.
Description: The time operand refers to the last access time of the file
(This option is ignored if no time operand is specified).
--timeAccess or -a option is setpublic boolean isTimeModified()
--timeModified option
is set. The option is also known as -m option.
Description: The time operand refers to the last modification time of the file (the default)
(This option is ignored if no time operand is specified).
--timeModified or -m option is setpublic boolean isPrint0()
--print0 option
is set. The option is also known as -z option.
Description: Print the full file name on the standard output, followed by a null character (instead of the newline character used by default). This allows file names that contain newlines or other types of white space to be correctly interpreted by programs that process the find output. This option corresponds to the --delimiter0 option of xargs.
--print0 or -z option is setpublic String toString()
ArgumentstoString in interface Arguments<FindArguments>toString in class ObjectCopyright © 2025. All rights reserved.