public abstract class BaseExpression extends Object implements Expression, Configurable
Find
command. Provides default
behavior for a no-argument primary expression.Constructor and Description |
---|
BaseExpression() |
Modifier and Type | Method and Description |
---|---|
protected void |
addArgument(String arg)
Add a single argument to this expression.
|
void |
addArguments(Deque<String> args)
Adds arguments to this expression.
|
protected void |
addArguments(Deque<String> args,
int count)
Add a specific number of arguments to this expression.
|
void |
addChildren(Deque<Expression> exprs)
Adds children to this expression.
|
protected void |
addChildren(Deque<Expression> exprs,
int count)
Add a specific number of children to this expression.
|
void |
finish()
Finishes the expression, called once after processing all items.
|
protected String |
getArgument(int position)
Returns the argument at the given position (starting from 1).
|
protected List<String> |
getArguments()
Returns the arguments of this expression
|
protected List<Expression> |
getChildren()
Returns the children of this expression.
|
Configuration |
getConf()
Return the configuration used by this object.
|
protected FileStatus |
getFileStatus(org.apache.hadoop.fs.shell.PathData item,
int depth)
Returns the
FileStatus from the PathData item. |
protected FileSystem |
getFileSystem(org.apache.hadoop.fs.shell.PathData item)
Returns the
FileSystem associated with the PathData item. |
String[] |
getHelp()
Returns a description of the expression for use in help.
|
protected FindOptions |
getOptions()
Return the options to be used by this expression.
|
protected Path |
getPath(org.apache.hadoop.fs.shell.PathData item)
Returns the
Path from the PathData item. |
int |
getPrecedence()
Returns the precedence of this expression
(only applicable to operators).
|
String[] |
getUsage()
Returns brief usage instructions for this expression.
|
boolean |
isAction()
Indicates whether this expression performs an action, i.e.
|
boolean |
isOperator()
Identifies the expression as an operator rather than a primary.
|
void |
prepare()
Prepares the expression for execution, called once after setting options
and before processing any options.
|
void |
setConf(Configuration conf)
Set the configuration to be used by this object.
|
protected void |
setHelp(String[] help)
Sets the help text for this
Expression |
void |
setOptions(FindOptions options)
Set the options for this expression, called once before processing any
items.
|
protected void |
setUsage(String[] usage)
Sets the usage text for this
Expression |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
apply
public BaseExpression()
protected void setUsage(String[] usage)
Expression
protected void setHelp(String[] help)
Expression
public String[] getUsage()
Expression
getUsage
in interface Expression
public String[] getHelp()
Expression
getHelp
in interface Expression
public void setOptions(FindOptions options) throws IOException
Expression
setOptions
in interface Expression
IOException
public void prepare() throws IOException
Expression
prepare
in interface Expression
IOException
public void finish() throws IOException
Expression
finish
in interface Expression
IOException
protected FindOptions getOptions()
public void setConf(Configuration conf)
Configurable
setConf
in interface Configurable
public Configuration getConf()
Configurable
getConf
in interface Configurable
public boolean isAction()
Expression
isAction
in interface Expression
public boolean isOperator()
Expression
isOperator
in interface Expression
protected List<String> getArguments()
protected String getArgument(int position) throws IOException
position
- argument to be returnedIOException
- if the argument doesn't exist or is nullprotected List<Expression> getChildren()
public int getPrecedence()
Expression
getPrecedence
in interface Expression
public void addChildren(Deque<Expression> exprs)
Expression
addChildren
in interface Expression
exprs
- deque of expressions from which to take the childrenprotected void addChildren(Deque<Expression> exprs, int count)
exprs
- deque of expressions from which to take the childrencount
- number of children to be addedpublic void addArguments(Deque<String> args)
Expression
addArguments
in interface Expression
args
- deque of arguments from which to take expression argumentsprotected void addArguments(Deque<String> args, int count)
args
- deque of arguments from which to take the argumentcount
- number of children to be addedprotected void addArgument(String arg)
arg
- argument to add to the expressionprotected FileStatus getFileStatus(org.apache.hadoop.fs.shell.PathData item, int depth) throws IOException
FileStatus
from the PathData
item. If the
current options require links to be followed then the returned file status
is that of the linked file.item
- PathDatadepth
- current depth in the process directoriesIOException
protected Path getPath(org.apache.hadoop.fs.shell.PathData item) throws IOException
Path
from the PathData
item.item
- PathDataIOException
protected FileSystem getFileSystem(org.apache.hadoop.fs.shell.PathData item) throws IOException
FileSystem
associated with the PathData
item.item
- PathDataIOException
Copyright © 2017 Apache Software Foundation. All Rights Reserved.