Package org.apache.hadoop.fs.shell.find
Interface Expression
- All Known Implementing Classes:
BaseExpression,FilterExpression
public interface Expression
Interface describing an expression to be used in the
Find command.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddArguments(Deque<String> args) Adds arguments to this expression.voidaddChildren(Deque<Expression> expressions) Adds children to this expression.Apply the expression to the specified item, called once for each item.voidfinish()Finishes the expression, called once after processing all items.String[]getHelp()Returns a description of the expression for use in help.intReturns the precedence of this expression (only applicable to operators).String[]getUsage()Returns brief usage instructions for this expression.booleanisAction()Indicates whether this expression performs an action, i.e. provides output back to the user.booleanIdentifies the expression as an operator rather than a primary.voidprepare()Prepares the expression for execution, called once after setting options and before processing any options.voidsetOptions(FindOptions options) Set the options for this expression, called once before processing any items.
-
Method Details
-
setOptions
Set the options for this expression, called once before processing any items.- Parameters:
options- options.- Throws:
IOException- raised on errors performing I/O.
-
prepare
Prepares the expression for execution, called once after setting options and before processing any options.- Throws:
IOException- raised on errors performing I/O.
-
apply
Apply the expression to the specified item, called once for each item.- Parameters:
item-PathDataitem to be processeddepth- distance of the item from the command line argument- Returns:
Resultof applying the expression to the item- Throws:
IOException- raised on errors performing I/O.
-
finish
Finishes the expression, called once after processing all items.- Throws:
IOException- raised on errors performing I/O.
-
getUsage
String[] getUsage()Returns brief usage instructions for this expression. Multiple items should be returned if there are multiple ways to use this expression.- Returns:
- array of usage instructions
-
getHelp
String[] getHelp()Returns a description of the expression for use in help. Multiple lines should be returned array items. Lines should be formated to 60 characters or less.- Returns:
- array of description lines
-
isAction
boolean isAction()Indicates whether this expression performs an action, i.e. provides output back to the user.- Returns:
- if is action true, not false.
-
isOperator
boolean isOperator()Identifies the expression as an operator rather than a primary.- Returns:
- if is operator true, not false.
-
getPrecedence
int getPrecedence()Returns the precedence of this expression (only applicable to operators).- Returns:
- precedence.
-
addChildren
Adds children to this expression. Children are popped from the head of the deque.- Parameters:
expressions- deque of expressions from which to take the children
-
addArguments
Adds arguments to this expression. Arguments are popped from the head of the deque and added to the front of the child list, ie last child added is the first evaluated.- Parameters:
args- deque of arguments from which to take expression arguments
-