|
||||||||||
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 org.apache.commons.betwixt.io.read.ReadContext
public class ReadContext
Extends Context
to provide read specific functionality.
Three stacks are used to manage the reading:
MappingAction
's
used to execute the mapping of the current element and it's ancesters back to the
document root.
Constructor Summary | |
---|---|
ReadContext(BindingConfiguration bindingConfiguration,
ReadConfiguration readConfiguration)
Constructs a ReadContext with standard log. |
|
ReadContext(Context context,
ReadConfiguration readConfiguration)
Constructs a ReadContext with the same settings
as an existing Context . |
|
ReadContext(org.apache.commons.logging.Log log,
BindingConfiguration bindingConfiguration,
ReadConfiguration readConfiguration)
Base constructor |
|
ReadContext(ReadContext readContext)
Constructs a ReadContext
with the same settings as an existing Context . |
Method Summary | |
---|---|
void |
clearBeans()
Clears the beans indexed by id. |
MappingAction |
currentMappingAction()
Gets the current mapping action |
ActionMappingStrategy |
getActionMappingStrategy()
Gets the strategy used to define default mappings actions for elements. |
java.lang.Object |
getBean()
Gets the current bean. |
java.lang.Object |
getBean(java.lang.String id)
Gets a bean from storage by an (xml) ID. |
BeanCreationChain |
getBeanCreationChain()
Gets the BeanCreationChange to be used to create beans
when an element is mapped. |
java.lang.ClassLoader |
getClassLoader()
Gets the classloader to be used. |
ElementDescriptor |
getCurrentDescriptor()
Gets the ElementDescriptor that describes the
mapping for the current element. |
java.lang.String |
getCurrentElement()
Gets the element name for the currently mapped element. |
Updater |
getCurrentUpdater()
Gets the current Updater . |
java.lang.Class |
getLastMappedClass()
Gets the Class that was last mapped, if there is one. |
java.lang.Class |
getRootClass()
|
XMLIntrospector |
getXMLIntrospector()
Gets the XMLIntrospector to be used to create
the mappings for the xml. |
void |
markClassMap(java.lang.Class mappedClazz)
Marks the element name stack with a class mapping. |
java.lang.Object |
popBean()
Pops the last mapping Object from the
stack containing beans that have been mapped. |
java.lang.String |
popElement()
Pops the top element from the element mapping stack. |
MappingAction |
popMappingAction()
Pops an action mapping from the stack |
void |
populateAttributes(AttributeDescriptor[] attributeDescriptors,
org.xml.sax.Attributes attributes)
Populates the object mapped by the AttributeDescriptor s
with the values in the given Attributes . |
Updater |
popUpdater()
Pops the top Updater from the stack. |
void |
pushBean(java.lang.Object bean)
Pushs a newly mapped Object onto the mapped bean stack. |
void |
pushElement(java.lang.String elementName)
Pushes the given element onto the element mapping stack. |
void |
pushMappingAction(MappingAction mappingAction)
Pushs an action mapping onto the stack |
void |
pushUpdater(Updater updater)
Pushes an Updater onto the stack. |
void |
putBean(java.lang.String id,
java.lang.Object bean)
Puts a bean into storage indexed by an (xml) ID. |
java.lang.Class |
resolvePolymorphicType(ElementMapping mapping)
Resolves any polymorphism in the element mapping. |
void |
setBean(java.lang.Object bean)
Set the current bean. |
void |
setClassLoader(java.lang.ClassLoader classLoader)
Sets the classloader to be used. |
void |
setRootClass(java.lang.Class rootClass)
|
void |
setXMLIntrospector(XMLIntrospector xmlIntrospector)
Sets the XMLIntrospector to be used to create
the mappings for the xml. |
Methods inherited from class org.apache.commons.betwixt.expression.Context |
---|
getClassNameAttribute, getIdMappingStrategy, getInheritedOption, getLog, getMapIDs, getObjectStringConverter, getOptions, getValueSuppressionStrategy, getVariable, getVariables, newContext, popOptions, pushOptions, setClassNameAttribute, setLog, setValueSuppressionStrategy, setVariable, setVariables |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReadContext(Context context, ReadConfiguration readConfiguration)
ReadContext
with the same settings
as an existing Context
.
context
- not nullreadConfiguration
- not nullpublic ReadContext(BindingConfiguration bindingConfiguration, ReadConfiguration readConfiguration)
ReadContext
with standard log.
bindingConfiguration
- the dynamic configuration, not nullreadConfiguration
- the extra read configuration not nullpublic ReadContext(org.apache.commons.logging.Log log, BindingConfiguration bindingConfiguration, ReadConfiguration readConfiguration)
log
- log to this LogbindingConfiguration
- the dynamic configuration, not nullreadConfiguration
- the extra read configuration not nullpublic ReadContext(ReadContext readContext)
ReadContext
with the same settings as an existing Context
.
readContext
- not nullMethod Detail |
---|
public void putBean(java.lang.String id, java.lang.Object bean)
id
- the ID string of the xml element associated with the beanbean
- the Object to store, not nullpublic java.lang.Object getBean(java.lang.String id)
id
- the ID string of the xml element associated with the bean
public void clearBeans()
public java.lang.ClassLoader getClassLoader()
public void setClassLoader(java.lang.ClassLoader classLoader)
classLoader
- the ClassLoader to be used, possibly nullpublic BeanCreationChain getBeanCreationChain()
BeanCreationChange
to be used to create beans
when an element is mapped.
public ActionMappingStrategy getActionMappingStrategy()
ActionMappingStrategy
. not nullpublic java.lang.String popElement()
public java.lang.String getCurrentElement()
public java.lang.Class getLastMappedClass()
public void pushElement(java.lang.String elementName) throws java.lang.Exception
elementName
- the local name if the parser is namespace aware,
otherwise the full element name. Not null
java.lang.Exception
public void markClassMap(java.lang.Class mappedClazz) throws java.beans.IntrospectionException
mappedClazz
- the Class which has been mapped at the current path, not null
java.beans.IntrospectionException
public MappingAction popMappingAction()
MappingAction
, not nullpublic void pushMappingAction(MappingAction mappingAction)
mappingAction
- public MappingAction currentMappingAction()
public java.lang.Object getBean()
Context
getBean
in class Context
public void setBean(java.lang.Object bean)
Context
setBean
in class Context
bean
- the Object against which expressions will be evaluatedpublic java.lang.Object popBean()
Object
from the
stack containing beans that have been mapped.
public void pushBean(java.lang.Object bean)
Object
onto the mapped bean stack.
bean
- public XMLIntrospector getXMLIntrospector()
XMLIntrospector
to be used to create
the mappings for the xml.
XMLIntrospector
, not nullpublic void setXMLIntrospector(XMLIntrospector xmlIntrospector)
XMLIntrospector
to be used to create
the mappings for the xml.
xmlIntrospector
- XMLIntrospector
, not nullpublic java.lang.Class getRootClass()
public void setRootClass(java.lang.Class rootClass)
public ElementDescriptor getCurrentDescriptor() throws java.lang.Exception
ElementDescriptor
that describes the
mapping for the current element.
ElementDescriptor
or null if there is no
current mapping
java.lang.Exception
public void populateAttributes(AttributeDescriptor[] attributeDescriptors, org.xml.sax.Attributes attributes)
AttributeDescriptor
s
with the values in the given Attributes
.
attributeDescriptors
- AttributeDescriptor
s, not nullattributes
- Attributes
, not nullpublic void pushUpdater(Updater updater)
Pushes an Updater
onto the stack.
NoteAny action pushing an Updater
onto
the stack should take responsibility for popping
the updater from the stack at an appropriate time.
Usage: this may be used by actions which require a temporary object to be updated. Pushing an updater onto the stack allow actions downstream to transparently update the temporary proxy.
updater
- Updater, possibly nullpublic Updater popUpdater()
Updater
from the stack.
NoteAny action pushing an Updater
onto
the stack should take responsibility for popping
the updater from the stack at an appropriate time.
Updater
, possibly nullpublic Updater getCurrentUpdater()
Updater
.
This may (or may not) be the updater for the current
descriptor.
If the current descriptor is a bean child,
the the current updater will (most likely)
be the updater for the property.
Actions (that, for example, use proxy objects)
may push updaters onto the stack.
public java.lang.Class resolvePolymorphicType(ElementMapping mapping)
mapping
- ElementMapping
describing the mapped element
null
if the type cannot be resolved
or if the current descriptor is not polymorphic
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |