|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.betwixt.expression.Context
public class Context
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.
Constructor Summary | |
---|---|
Context()
Construct context with default log |
|
Context(Context context)
Construct a cloned context. |
|
Context(java.lang.Object bean,
org.apache.commons.logging.Log log)
Deprecated. 0.5 use constructor which takes a BindingConfiguration |
|
Context(java.lang.Object bean,
org.apache.commons.logging.Log log,
BindingConfiguration bindingConfiguration)
Convenience constructor sets evaluted bean and log. |
|
Context(java.lang.Object bean,
java.util.Map variables,
org.apache.commons.logging.Log log)
Deprecated. 0.5 use constructor which takes a converter |
|
Context(java.lang.Object bean,
java.util.Map variables,
org.apache.commons.logging.Log log,
BindingConfiguration bindingConfiguration)
Convenience constructor sets evaluted bean, context variables and log. |
Method Summary | |
---|---|
java.lang.Object |
getBean()
Gets the current bean. |
java.lang.String |
getClassNameAttribute()
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. |
IdStoringStrategy |
getIdMappingStrategy()
Gets the strategy used to manage storage and retrieval of id's. |
java.lang.String |
getInheritedOption(java.lang.String name)
Gets the value of the first option with this name. |
org.apache.commons.logging.Log |
getLog()
Gets the current log. |
boolean |
getMapIDs()
Should ID 's and IDREF attributes
be used to cross-reference matching objects? |
ObjectStringConverter |
getObjectStringConverter()
Gets object <-> string converter. |
Options |
getOptions()
Gets the current Options . |
ValueSuppressionStrategy |
getValueSuppressionStrategy()
Gets the ValueSuppressionStrategy . |
java.lang.Object |
getVariable(java.lang.String name)
Gets the value of a particular context variable. |
java.util.Map |
getVariables()
Gets context variables. |
Context |
newContext(java.lang.Object newBean)
Returns a new child context with the given bean but the same log and variables. |
void |
popOptions()
Pops the current options from the stack. |
void |
pushOptions(Options options)
Pushes the given Options onto the stack. |
void |
setBean(java.lang.Object bean)
Set the current bean. |
void |
setClassNameAttribute(java.lang.String classNameAttribute)
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. |
void |
setLog(org.apache.commons.logging.Log log)
Set the log implementation to which this class logs |
void |
setValueSuppressionStrategy(ValueSuppressionStrategy valueSuppressionStrategy)
Sets the ValueSuppressionStrategy . |
void |
setVariable(java.lang.String name,
java.lang.Object value)
Sets the value of a particular context variable. |
void |
setVariables(java.util.Map variables)
Sets context variables. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Context()
public Context(java.lang.Object bean, org.apache.commons.logging.Log log)
bean
- evaluate expressions against this beanlog
- log to this loggerpublic Context(java.lang.Object bean, org.apache.commons.logging.Log log, BindingConfiguration bindingConfiguration)
bean
- evaluate expressions against this beanlog
- log to this loggerbindingConfiguration
- not nullpublic Context(Context context)
context
- duplicate the attributes of this beanpublic Context(java.lang.Object bean, java.util.Map variables, org.apache.commons.logging.Log log)
bean
- evaluate expressions against this beanvariables
- context variableslog
- log to this loggerpublic Context(java.lang.Object bean, java.util.Map variables, org.apache.commons.logging.Log log, BindingConfiguration bindingConfiguration)
bean
- evaluate expressions against this beanvariables
- context variableslog
- log to this loggerbindingConfiguration
- not nullMethod Detail |
---|
public Context newContext(java.lang.Object newBean)
newBean
- create a child context for this bean
public java.lang.Object getBean()
public void setBean(java.lang.Object bean)
bean
- the Object against which expressions will be evaluatedpublic java.util.Map getVariables()
public void setVariables(java.util.Map variables)
variables
- map containing variable values indexed by varibable name Stringspublic java.lang.Object getVariable(java.lang.String name)
name
- the name of the variable whose value is to be returned
public void setVariable(java.lang.String name, java.lang.Object value)
name
- the name of the variablevalue
- the value of the variablepublic org.apache.commons.logging.Log getLog()
public void setLog(org.apache.commons.logging.Log log)
log
- the implemetation that this class should log topublic ObjectStringConverter getObjectStringConverter()
public boolean getMapIDs()
ID
's and IDREF
attributes
be used to cross-reference matching objects?
ID
and IDREF
attributes should be used to cross-reference instancespublic java.lang.String getClassNameAttribute()
The default value is 'className'.
public void setClassNameAttribute(java.lang.String classNameAttribute)
The default value is 'className'.
classNameAttribute
- The name of the attribute used to overload the class name of a beanpublic ValueSuppressionStrategy getValueSuppressionStrategy()
ValueSuppressionStrategy
.
This is used to control the expression of attributes with certain values.
ValueSuppressionStrategy
, not nullpublic void setValueSuppressionStrategy(ValueSuppressionStrategy valueSuppressionStrategy)
ValueSuppressionStrategy
.
This is used to control the expression of attributes with certain values.
valueSuppressionStrategy
- ValueSuppressionStrategy
, not nullpublic IdStoringStrategy getIdMappingStrategy()
public Options getOptions()
Options
.
Options
that currently apply
or null if there are no current options.public void pushOptions(Options options)
Pushes the given Options
onto the stack.
Note that code calling push should ensure that popOptions()
is called once the options are no longer current.
This ensures that the previous options are reinstated.
options
- newly current Options
, not nullpublic void popOptions()
Pops the current options from the stack. The previously current options (if any exist) will be reinstated by this method.
popOptions()
.
public java.lang.String getInheritedOption(java.lang.String name)
name
- the name of the option to be found
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |