| java.lang.Object org.apache.commons.betwixt.expression.Context
All known Subclasses: org.apache.commons.betwixt.io.read.ReadContext,
Context | public class Context (Code) | | Context describes the context used to evaluate
bean expressions.
This is mostly a bean together with a number of context variables.
Context variables are named objects.
In other words,
a context variable associates an object with a string.
Logging during expression evaluation is done through the logging
instance held by this class.
The object initiating the evaluation should control this logging
and so passing a Log instance is enforced by the constructors.
Context is a natural place to include shared evaluation code.
One of the problems that you get with object graphs is that they can be cyclic.
Xml cannot (directly) include cycles.
Therefore betwixt needs to find and deal properly with cycles.
The algorithm used is to check the parentage of a new child.
If the child is a parent then that operation fails.
author: James Strachan |
Constructor Summary | |
public | Context() | public | Context(Object bean, Log log) Convenience constructor sets evaluted bean and log. | public | Context(Object bean, Log log, BindingConfiguration bindingConfiguration) Convenience constructor sets evaluted bean and log. | public | Context(Context context) Construct a cloned context. | public | Context(Object bean, Map variables, Log log) Convenience constructor sets evaluted bean, context variables and log. | public | Context(Object bean, Map variables, Log log, BindingConfiguration bindingConfiguration) Convenience constructor sets evaluted bean, context variables and log. |
Context | public Context()(Code) | | Construct context with default log
|
Context | public Context(Object bean, Log log)(Code) | | Convenience constructor sets evaluted bean and log.
Parameters: bean - evaluate expressions against this bean Parameters: log - log to this logger |
Context | public Context(Object bean, Log log, BindingConfiguration bindingConfiguration)(Code) | | Convenience constructor sets evaluted bean and log.
Parameters: bean - evaluate expressions against this bean Parameters: log - log to this logger Parameters: bindingConfiguration - not null |
Context | public Context(Context context)(Code) | | Construct a cloned context.
The constructed context should share bean, variables, log and binding configuration.
Parameters: context - duplicate the attributes of this bean |
Context | public Context(Object bean, Map variables, Log log)(Code) | | Convenience constructor sets evaluted bean, context variables and log.
Parameters: bean - evaluate expressions against this bean Parameters: variables - context variables Parameters: log - log to this logger |
Context | public Context(Object bean, Map variables, Log log, BindingConfiguration bindingConfiguration)(Code) | | Convenience constructor sets evaluted bean, context variables and log.
Parameters: bean - evaluate expressions against this bean Parameters: variables - context variables Parameters: log - log to this logger Parameters: bindingConfiguration - not null |
getBean | public Object getBean()(Code) | | Gets the current bean.
the bean against which expressions are evaluated |
getClassNameAttribute | public String getClassNameAttribute()(Code) | | The name of the attribute which can be specified in the XML to override the
type of a bean used at a certain point in the schema.
The default value is 'className'.
The name of the attribute used to overload the class name of a bean since: 0.5 |
getIdMappingStrategy | public IdStoringStrategy getIdMappingStrategy()(Code) | | Gets the strategy used to manage storage and retrieval of id's.
since: 0.7 Returns the idStoringStrategy, not null |
getInheritedOption | public String getInheritedOption(String name)(Code) | | Gets the value of the first option with this name.
The stack of inherited options is search (starting
from the current option) until an option with a non-null
value for the named option is found.
Parameters: name - the name of the option to be found option value or null if this value is never set since: 0.8 |
getLog | public Log getLog()(Code) | | Gets the current log.
the implementation to which this class logs |
getMapIDs | public boolean getMapIDs()(Code) | | Should ID 's and IDREF attributes
be used to cross-reference matching objects?
true if ID and IDREF attributes should be used to cross-reference instances since: 0.5 |
getObjectStringConverter | public ObjectStringConverter getObjectStringConverter()(Code) | | Gets object <-> string converter.
the Converter to be used for conversions, not null since: 0.5 |
getOptions | public Options getOptions()(Code) | | Gets the current Options .
Options that currently applyor null if there are no current options. since: 0.7 |
getValueSuppressionStrategy | public ValueSuppressionStrategy getValueSuppressionStrategy()(Code) | | Gets the ValueSuppressionStrategy .
This is used to control the expression of attributes with certain values.
since: 0.7 ValueSuppressionStrategy , not null |
getVariable | public Object getVariable(String name)(Code) | | Gets the value of a particular context variable.
Parameters: name - the name of the variable whose value is to be returned the variable value or null if the variable isn't set |
getVariables | public Map getVariables()(Code) | | Gets context variables.
map containing variable values keyed by variable name |
newContext | public Context newContext(Object newBean)(Code) | | Returns a new child context with the given bean but the same log and variables.
Parameters: newBean - create a child context for this bean new Context with new bean but shared variables |
popOptions | public void popOptions()(Code) | | Pops the current options from the stack.
The previously current options (if any exist)
will be reinstated by this method.
Note code calling this method should
have previsouly called
Context.popOptions .
since: 0.7 |
pushOptions | public void pushOptions(Options options)(Code) | | Pushes the given Options onto the stack.
Note that code calling push should ensure that
Context.popOptions is called once the options are no longer current.
This ensures that the previous options are reinstated.
since: 0.7 Parameters: options - newly current Options , not null |
setBean | public void setBean(Object bean)(Code) | | Set the current bean.
Parameters: bean - the Object against which expressions will be evaluated |
setClassNameAttribute | public void setClassNameAttribute(String classNameAttribute)(Code) | | Sets the name of the attribute which can be specified in
the XML to override the type of a bean used at a certain
point in the schema.
The default value is 'className'.
Parameters: classNameAttribute - The name of the attribute used to overload the class name of a bean since: 0.5 |
setLog | public void setLog(Log log)(Code) | | Set the log implementation to which this class logs
Parameters: log - the implemetation that this class should log to |
setValueSuppressionStrategy | public void setValueSuppressionStrategy(ValueSuppressionStrategy valueSuppressionStrategy)(Code) | | Sets the ValueSuppressionStrategy .
This is used to control the expression of attributes with certain values.
since: 0.7 Parameters: valueSuppressionStrategy - ValueSuppressionStrategy , not null |
setVariable | public void setVariable(String name, Object value)(Code) | | Sets the value of a particular context variable.
Parameters: name - the name of the variable Parameters: value - the value of the variable |
setVariables | public void setVariables(Map variables)(Code) | | Sets context variables.
Parameters: variables - map containing variable values indexed by varibable name Strings |
|
|