net.sf.sasl.language.placeholder.aop.interpreter
Class ASTInterpreter

java.lang.Object
  extended by net.sf.sasl.language.placeholder.aop.interpreter.ASTInterpreter
All Implemented Interfaces:
IInterpreter

public class ASTInterpreter
extends Object
implements IInterpreter

Small interpreter that can interpreter a placeholder script given as an abstract placeholder syntax tree.
The targetMethod, targetObject, occuredException, targetReturnValue and targetArguments properties of IEnvironment will be also offered as interpreter environment variables.

Since:
0.0.1 (sasl-common-aspect-library)
Author:
Philipp Förmer

Constructor Summary
ASTInterpreter(ScriptNode script, IPlaceholderResolverSymbolTable symbolTable, IEnvironment environment)
           
ASTInterpreter(ScriptNode script, List<IPlaceholderResolver> resolverList, IEnvironment environment)
           
 
Method Summary
 String interpret()
          Interprets the placeholder script and returns the constructed string output.
 void setEnvironmentVariable(String name, Object value)
          Adds a shared environment variable, which could be accessed by placeholder resolvers, to the interpreter environment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASTInterpreter

public ASTInterpreter(ScriptNode script,
                      List<IPlaceholderResolver> resolverList,
                      IEnvironment environment)
               throws IllegalArgumentException
Parameters:
script - non null
resolverList - non null
environment - non null
Throws:
IllegalArgumentException - if one of the input parameters is null or the environment has got a null execution phase, target method or target object.
Since:
0.0.1 (sasl-common-aspect-library)

ASTInterpreter

public ASTInterpreter(ScriptNode script,
                      IPlaceholderResolverSymbolTable symbolTable,
                      IEnvironment environment)
               throws IllegalArgumentException
Parameters:
script - non null.
symbolTable - non null.
environment - non null.
Throws:
IllegalArgumentException - if one of the input parameters is null or the environment has got a null execution phase, target method or target object.
Since:
0.0.2 (sasl-common-aspect-library)
Method Detail

setEnvironmentVariable

public void setEnvironmentVariable(String name,
                                   Object value)
Adds a shared environment variable, which could be accessed by placeholder resolvers, to the interpreter environment.

Parameters:
name - null or non null
value - null or non null
Since:
0.0.1 (sasl-common-aspect-library)

interpret

public String interpret()
                 throws InterpreterException
Description copied from interface: IInterpreter
Interprets the placeholder script and returns the constructed string output.

Specified by:
interpret in interface IInterpreter
Returns:
non null
Throws:
InterpreterException - if any exception occurs during interpreting the placeholder script.
Since:
0.0.1 (sasl-common-aspect-library)
See Also:
IInterpreter.interpret()


Copyright © 2010. All Rights Reserved.