org.specrunner.parameters
Interface IParameterDecorator

All Known Implementing Classes:
ParameterDecoratorImpl

public interface IParameterDecorator

Stand for anything that can have parameters set. It is a bypass parameters capturer.

Author:
Thiago Santos

Field Summary
static String INVERT_FLAG
          All expressions are evaluated unless annotation @DontEval is added.
static String LATE_FLAG
          Force the evaluation at the end of plugin execution.
static String SILENT_FLAG
          Invert evaluation 'silence'.
 
Method Summary
 String clear(String name)
          Get name cleared.
 Map<String,Object> getAllParameters()
          Map of parameters set.
 Object getDecorated()
          Gets the decorated object.
 Object getParameter(String name)
          Gets a parameter.
 Map<String,Object> getParameters()
          Map of parameters set.
 boolean hasParameter(String name)
          Check if a parameter name is valid.
 boolean isEval(String name)
          Check if a given name has to be evaluated.
 boolean isLate(String name)
          Check if a given name has to be evaluated at the end or not.
 boolean isSilent(String name)
          Check if a given name has to be evaluated silently or not.
 void setAllParameters(Map<String,Object> allParameters)
          Set of all parameters map.
 void setDecorated(Object decorated)
          Sets the decorated object.
 Object setParameter(String name, Object value, IContext context)
          Set a parameter.
 void setParameters(Map<String,Object> parameters)
          Set parameters map.
 

Field Detail

INVERT_FLAG

static final String INVERT_FLAG
All expressions are evaluated unless annotation @DontEval is added. If the attribute has this flag the evaluation behavior is the opposite: not annotated attributes wont be evaluated, and annotate attributes will be evaluated.

See Also:
Constant Field Values

SILENT_FLAG

static final String SILENT_FLAG
Invert evaluation 'silence'. All expression are silent unless @Unsilent is specified for the feature.

See Also:
Constant Field Values

LATE_FLAG

static final String LATE_FLAG
Force the evaluation at the end of plugin execution. Attributes will be evaluated on end.

See Also:
Constant Field Values
Method Detail

getDecorated

Object getDecorated()
Gets the decorated object.

Returns:
The object.

setDecorated

void setDecorated(Object decorated)
Sets the decorated object. Reset all parameters information.

Parameters:
decorated - The new decorated object.

isEval

boolean isEval(String name)
Check if a given name has to be evaluated.

Parameters:
name - The feature name.
Returns:
true, to evaluate, false, otherwise. Default is true.

isSilent

boolean isSilent(String name)
Check if a given name has to be evaluated silently or not.

Parameters:
name - The feature name.
Returns:
true, to silent evaluation, false, otherwise. Default is true.

isLate

boolean isLate(String name)
Check if a given name has to be evaluated at the end or not.

Parameters:
name - The feature name.
Returns:
true, to late evaluation, false, otherwise. Default is false.

clear

String clear(String name)
Get name cleared.

Parameters:
name - The name.
Returns:
Cleared string.

setParameter

Object setParameter(String name,
                    Object value,
                    IContext context)
                    throws Exception
Set a parameter.

Parameters:
name - The parameter name.
value - The parameter value.
context - The context where value is insert.
Returns:
The resulting value of setting 'name' with the value in a given context. i.e. If context has a variable 'x' bind to 1(integer) and we ask to set 'name' to 'x', the operation output will be '1', but if feature 'name' in the decorated object has a annotation @DontEval the result will be 'x'.
Throws:
Exception - On evaluation error.

getParameter

Object getParameter(String name)
Gets a parameter.

Parameters:
name - The parameter name.
Returns:
The parameter value.

hasParameter

boolean hasParameter(String name)
Check if a parameter name is valid.

Parameters:
name - The parameter.
Returns:
The parameter name.

getParameters

Map<String,Object> getParameters()
Map of parameters set. Only parameters properly set to object are available.

Returns:
The parameter mapping containing only parameters properly set.

setParameters

void setParameters(Map<String,Object> parameters)
Set parameters map.

Parameters:
parameters - The map.

getAllParameters

Map<String,Object> getAllParameters()
Map of parameters set. All parameters tried to be set in the object, even those whose corresponding property is not present in object.

Returns:
The parameter mapping containing all parameters set.

setAllParameters

void setAllParameters(Map<String,Object> allParameters)
Set of all parameters map.

Parameters:
allParameters - The map.


Copyright © 2014. All rights reserved.