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

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

public class Environment
extends Object
implements IEnvironment

Default implementation of the environment interface. Does not guarantee on its own the the contract conditions of the interface.

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

Constructor Summary
Environment(IInterpreter interpreter)
          Creates an environment object that belongs to the given interpreter.
 
Method Summary
 Map<String,Object> getEnvironmentProperties()
          Returns a map of shared properties of the interpreter environment.
 Object getEnvironmentProperty(String key)
          Returns a shared object to the over given key that is offered by the interpreter environment.
 TargetMethodExecutionPhase getExecutionPhase()
          Returns the execution phase of the target method to which this environment belongs.
 IInterpreter getInterpreter()
          Returns the interpreter which interprets a placeholder script for the current environment.
 Throwable getOccurredException()
          Returns the occurred exception of the target method invocation.
 Object[] getTargetArguments()
          Returns the target arguments of a method invocation.
 Method getTargetMethod()
          Returns the target method of a method invocation.
 Object getTargetObject()
          Returns the target object of a method invocation.
 Object getTargetReturnValue()
          Returns the target return value of a method invocation.
 void setEnvironmentProperties(Map<String,Object> properties)
          Overrides the shared property map with th given property map.
 void setEnvironmentProperty(String key, Object value)
          Sets a shared property of the interpreter environment.
 void setExecutionPhase(TargetMethodExecutionPhase executionPhase)
          Sets the execution phase to which this environment belongs.
 void setInterpreter(IInterpreter interpreter)
          Sets the interpreter to which this environment belongs.
 void setOccurredException(Throwable occuredException)
          Sets the occured exception that occured during the target method invocation.
 void setTargetArguments(Object[] targetArguments)
          Sets the target arguments of the target method invocation.
 void setTargetMethod(Method targetMethod)
          Sets the target method which gets or was called.
 void setTargetObject(Object targetObject)
          Sets the target object on which the target method gets or was invoked.
 void setTargetReturnValue(Object targetReturnValue)
          Sets the return value of the target method invocation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Environment

public Environment(IInterpreter interpreter)
Creates an environment object that belongs to the given interpreter.

Parameters:
interpreter - null or non null.
Since:
0.0.1 (sasl-common-aspect-library)
Method Detail

getExecutionPhase

public TargetMethodExecutionPhase getExecutionPhase()
Description copied from interface: IEnvironment
Returns the execution phase of the target method to which this environment belongs.

Specified by:
getExecutionPhase in interface IEnvironment
Returns:
non null.
Since:
0.0.1 (sasl-common-aspect-library)
See Also:
net.sf.sasl.language.placeholder.interpreter.IEnvironment#getExecutionPhase()

getInterpreter

public IInterpreter getInterpreter()
Description copied from interface: IEnvironment
Returns the interpreter which interprets a placeholder script for the current environment. Could be used for callbacks.

Specified by:
getInterpreter in interface IEnvironment
Returns:
non null.
Since:
0.0.1 (sasl-common-aspect-library)
See Also:
net.sf.sasl.language.placeholder.interpreter.IEnvironment#getInterpreter()

getOccurredException

public Throwable getOccurredException()
Description copied from interface: IEnvironment
Returns the occurred exception of the target method invocation. Only returns non null if the IEnvironment.getExecutionPhase() returns EXCEPTION.

Specified by:
getOccurredException in interface IEnvironment
Returns:
null or non null.
Since:
0.0.1 (sasl-common-aspect-library)
See Also:
net.sf.sasl.language.placeholder.interpreter.IEnvironment#getOccuredException()

getTargetArguments

public Object[] getTargetArguments()
Description copied from interface: IEnvironment
Returns the target arguments of a method invocation.

Specified by:
getTargetArguments in interface IEnvironment
Returns:
non null
Since:
0.0.1 (sasl-common-aspect-library)
See Also:
net.sf.sasl.language.placeholder.interpreter.IEnvironment#getTargetArguments()

getTargetMethod

public Method getTargetMethod()
Description copied from interface: IEnvironment
Returns the target method of a method invocation.

Specified by:
getTargetMethod in interface IEnvironment
Returns:
non null
Since:
0.0.1 (sasl-common-aspect-library)
See Also:
net.sf.sasl.language.placeholder.interpreter.IEnvironment#getTargetMethod()

getTargetObject

public Object getTargetObject()
Description copied from interface: IEnvironment
Returns the target object of a method invocation.

Specified by:
getTargetObject in interface IEnvironment
Returns:
non null
Since:
0.0.1 (sasl-common-aspect-library)
See Also:
net.sf.sasl.language.placeholder.interpreter.IEnvironment#getTargetObject()

getTargetReturnValue

public Object getTargetReturnValue()
Description copied from interface: IEnvironment
Returns the target return value of a method invocation. If the IEnvironment.getExecutionPhase() does not return INVOCATION than it will return definitely null.

Specified by:
getTargetReturnValue in interface IEnvironment
Returns:
null or non null.
Since:
0.0.1 (sasl-common-aspect-library)
See Also:
net.sf.sasl.language.placeholder.interpreter.IEnvironment#getTargetReturnValue()

setExecutionPhase

public void setExecutionPhase(TargetMethodExecutionPhase executionPhase)
Sets the execution phase to which this environment belongs.

Parameters:
executionPhase - null or non null.
Since:
0.0.1 (sasl-common-aspect-library)

setInterpreter

public void setInterpreter(IInterpreter interpreter)
Sets the interpreter to which this environment belongs.

Parameters:
interpreter - null or non null.
Since:
0.0.1 (sasl-common-aspect-library)

setOccurredException

public void setOccurredException(Throwable occuredException)
Sets the occured exception that occured during the target method invocation.

Parameters:
occuredException - null or non null.
Since:
0.0.1 (sasl-common-aspect-library)

setTargetArguments

public void setTargetArguments(Object[] targetArguments)
Sets the target arguments of the target method invocation. If the targetArguments parameter is null, than the value will be set to an empty array.

Parameters:
targetArguments - null or non null.
Since:
0.0.1 (sasl-common-aspect-library)

setTargetMethod

public void setTargetMethod(Method targetMethod)
Sets the target method which gets or was called.

Parameters:
targetMethod - null or non null.
Since:
0.0.1 (sasl-common-aspect-library)

setTargetObject

public void setTargetObject(Object targetObject)
Sets the target object on which the target method gets or was invoked.

Parameters:
targetObject - null or non null.
Since:
0.0.1 (sasl-common-aspect-library)

setTargetReturnValue

public void setTargetReturnValue(Object targetReturnValue)
Sets the return value of the target method invocation.

Parameters:
targetReturnValue - null or non null.
Since:
0.0.1 (sasl-common-aspect-library)

getEnvironmentProperty

public Object getEnvironmentProperty(String key)
Description copied from interface: IEnvironment
Returns a shared object to the over given key that is offered by the interpreter environment.

Specified by:
getEnvironmentProperty in interface IEnvironment
Parameters:
key - null or non null
Returns:
null or non null shared object instance.
See Also:
net.sf.sasl.language.placeholder.interpreter.IEnvironment#getEnvironmentProperty(java.lang.String)

setEnvironmentProperty

public void setEnvironmentProperty(String key,
                                   Object value)
Sets a shared property of the interpreter environment.

Specified by:
setEnvironmentProperty in interface IEnvironment
Parameters:
key - null or non null key under which the value is accessible.
value - null or non null
Since:
0.0.1 (sasl-common-aspect-library)

setEnvironmentProperties

public void setEnvironmentProperties(Map<String,Object> properties)
Overrides the shared property map with th given property map.

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

getEnvironmentProperties

public Map<String,Object> getEnvironmentProperties()
Description copied from interface: IEnvironment
Returns a map of shared properties of the interpreter environment.

Specified by:
getEnvironmentProperties in interface IEnvironment
Returns:
non null
See Also:
net.sf.sasl.language.placeholder.interpreter.IEnvironment#getEnvironmentProperties()


Copyright © 2010. All Rights Reserved.