|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.xb.binding.MappingObjectModelFactory
public class MappingObjectModelFactory
An ObjectModelFactory that uses mappings
Constructor Summary | |
---|---|
MappingObjectModelFactory()
|
Method Summary | |
---|---|
void |
addChild(Object parent,
Object child,
UnmarshallingContext ctx,
String namespaceURI,
String localName)
This method is called when parsing of a not top-level XML element completed. |
Object |
completeRoot(Object root,
UnmarshallingContext navigator,
String namespaceURI,
String localName)
This method is called by the framework when unmarshalling of the object graph completed. |
void |
mapElementToClass(String element,
Class cls)
Map an element to a class |
void |
mapElementToField(String element,
Class cls,
String field,
TypeBinding converter)
Map an element to a field |
Object |
newChild(Object o,
UnmarshallingContext ctx,
String namespaceURI,
String localName,
Attributes attrs)
This method is called when parsing of a new not top-level XML element started. |
Object |
newRoot(Object root,
UnmarshallingContext ctx,
String namespaceURI,
String localName,
Attributes attrs)
This method is called by the framework and returns the root of the object graph. |
void |
setValue(Object o,
UnmarshallingContext ctx,
String namespaceURI,
String localName,
String value)
This method is called when a new not top-level simple XML element (with text content) was parsed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MappingObjectModelFactory()
Method Detail |
---|
public void mapElementToClass(String element, Class cls)
element
- the element namecls
- the classpublic void mapElementToField(String element, Class cls, String field, TypeBinding converter)
element
- the element namecls
- the classfield
- the field nameconverter
- the type convertorpublic Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs)
ObjectModelFactory
root
argument is null, the factory is supposed to create and return a new one
that is going to be the real root object of the graph or an object that will represent the root object
during unmarshalling and which will be used to create the real root object when unmarshalling is complete
in completeRoot
if the real root object can't be created while its children are not available,
e.g. no no-arg constructor or other reasons.
If root
argument is not null (i.e. a user provided the root object through the
org.jboss.xml.binding.Unmarshaller
) then the factory could just return it as is or
extract the real root from the root
argument based on the namespace URI and local name
if root
argument wraps/contains the real root.
newRoot
in interface ObjectModelFactory
root
- an object that is the root or which contains the root of the object graphctx
- unmarshalling contextnamespaceURI
- namespace URI of the rootlocalName
- local name of the rootattrs
- attributes of the root object
public Object newChild(Object o, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs)
GenericObjectModelFactory
newChild
in interface GenericObjectModelFactory
o
- an object that represents the parent XML element in the object modelctx
- unmarshalling contextnamespaceURI
- namespace URI of the XML elementlocalName
- local name of the XML elementattrs
- attributes of the XML element
public void addChild(Object parent, Object child, UnmarshallingContext ctx, String namespaceURI, String localName)
GenericObjectModelFactory
addChild
in interface GenericObjectModelFactory
parent
- an object that represents the parent XML element in the object modelchild
- an object that was returned by the newChild
method that
was called when parsing of this XML element startedctx
- unmarshalling contextnamespaceURI
- namespace URI of the XML elementlocalName
- local name of the XML elementpublic void setValue(Object o, UnmarshallingContext ctx, String namespaceURI, String localName, String value)
GenericObjectModelFactory
setValue
in interface GenericObjectModelFactory
o
- an object that represents the parent XML element in the Java object modelctx
- unmarshalling contextnamespaceURI
- namespace URI of the XML elementlocalName
- local name of the XML elementvalue
- value of the XML element as it appears in the XML contentpublic Object completeRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName)
ObjectModelFactory
newRoot
returned not the real root object but an
object that represented the root during unmarshalling, the real root object should be created
and returned.
completeRoot
in interface ObjectModelFactory
root
- the object returned by newRoot
at the beginning of unmarshallingnavigator
- unmarshalling contextnamespaceURI
- namespace URI that corresponds to the rootlocalName
- local element name the root of the object graph is bound to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |