terp - the Codemesh Modular
Template Interpreter v1.3.304

com.codemesh.terp.eval.executors
Class IsFileTypeExecutor

java.lang.Object
  extended by com.codemesh.terp.api.Executor.AbstractExecutor<Rvalue>
      extended by com.codemesh.terp.eval.executors.IsFileTypeExecutor
All Implemented Interfaces:
Executor<Rvalue>, Selector<java.io.File>

public class IsFileTypeExecutor
extends Executor.AbstractExecutor<Rvalue>
implements Selector<java.io.File>

An executor that returns true if a file is of a certain type.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.codemesh.terp.api.Selector
Selector.AbstractSelector<T>
 
Nested classes/interfaces inherited from interface com.codemesh.terp.api.Executor
Executor.AbstractExecutor<T>, Executor.ForMethod
 
Field Summary
static int DIRECTORY
           
static int EXEC
           
static int FILE
           
static int HIDDEN
           
static int JAR
           
static int READ
           
static int WRITE
           
static int ZIP
           
 
Fields inherited from interface com.codemesh.terp.api.Selector
NO_ARGS, NO_PARAM_NAMES
 
Constructor Summary
IsFileTypeExecutor(int type)
           
 
Method Summary
 Rvalue execute(java.util.List<java.lang.Object> args, TerpEvaluator eval, TerpContext ctx)
          Performs the executor's action on the given arguments in the given context.
 java.lang.String getItemName()
          Returns the name used for the item that is being tested.
 java.lang.String[] getParamNames()
          Returns the parameter names.
 boolean matches(java.util.List<java.lang.Object> args)
          Returns true if the executor applies to the given arguments.
 boolean selects(java.io.File file, java.lang.Object owner)
          Returns true if the given item satisfies the selector's criteria.
 boolean selects(java.io.File file, java.lang.Object owner, java.util.List<java.lang.Object> args)
          Returns true if the given item satisfies the selector's criteria.
 
Methods inherited from class com.codemesh.terp.api.Executor.AbstractExecutor
execute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE

public static final int FILE
See Also:
Constant Field Values

DIRECTORY

public static final int DIRECTORY
See Also:
Constant Field Values

READ

public static final int READ
See Also:
Constant Field Values

WRITE

public static final int WRITE
See Also:
Constant Field Values

HIDDEN

public static final int HIDDEN
See Also:
Constant Field Values

EXEC

public static final int EXEC
See Also:
Constant Field Values

ZIP

public static final int ZIP
See Also:
Constant Field Values

JAR

public static final int JAR
See Also:
Constant Field Values
Constructor Detail

IsFileTypeExecutor

public IsFileTypeExecutor(int type)
Method Detail

matches

public boolean matches(java.util.List<java.lang.Object> args)
Description copied from interface: Executor
Returns true if the executor applies to the given arguments. Typically, your custom executor will implement this method to check for the proper number of arguments and the proper argument types.

Specified by:
matches in interface Executor<Rvalue>
Parameters:
args - the arguments passed to the executor.
Returns:
true if the executor knows how to handle the given arguments, false otherwise.

getItemName

public java.lang.String getItemName()
Description copied from interface: Selector
Returns the name used for the item that is being tested.

Specified by:
getItemName in interface Selector<java.io.File>
Returns:
a name.

getParamNames

public java.lang.String[] getParamNames()
Description copied from interface: Selector
Returns the parameter names.

Specified by:
getParamNames in interface Selector<java.io.File>
Returns:
an array of names.

selects

public boolean selects(java.io.File file,
                       java.lang.Object owner)
Description copied from interface: Selector
Returns true if the given item satisfies the selector's criteria.

Specified by:
selects in interface Selector<java.io.File>
Parameters:
file - the item to test.
owner - the item's owner, i.e. the object from which items are being selected.
Returns:
true if selection criteria are met.

selects

public boolean selects(java.io.File file,
                       java.lang.Object owner,
                       java.util.List<java.lang.Object> args)
Description copied from interface: Selector
Returns true if the given item satisfies the selector's criteria.

Specified by:
selects in interface Selector<java.io.File>
Parameters:
file - the item to test.
owner - the item's owner, i.e. the object from which items are being selected.
args - the arguments to be taken into account in the test. @return true if selection criteria are met.

execute

public Rvalue execute(java.util.List<java.lang.Object> args,
                      TerpEvaluator eval,
                      TerpContext ctx)
Description copied from interface: Executor
Performs the executor's action on the given arguments in the given context. Typically, your custom executor will implement this method to provide its core functionality.

Specified by:
execute in interface Executor<Rvalue>
Parameters:
args - the arguments.
eval - the evaluator to use. Can frequently be null.
ctx - the context in which the execution occurs. Can frequently be null.
Returns:
the execution result.

terp - the Codemesh Modular
Template Interpreter v1.3.304

Copyright © 2008-2012 by Codemesh, Inc. All Rights Reserved.