|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ComplexBinding
A strategy for parsing elements in an instance document which are of complex type.
Complex types contain child elements, and attributes. A complex strategy has the ability to
modules/extension/xsd-core (gt-xsd-core.jar)
Field Summary |
---|
Fields inherited from interface Binding |
---|
AFTER, BEFORE, OVERRIDE |
Method Summary | |
---|---|
Element |
encode(Object object,
Document document,
Element value)
Performs the encoding of the object into its xml representation. |
List |
getProperties(Object object)
Deprecated. use getProperties(Object, XSDElementDeclaration) . |
List |
getProperties(Object object,
XSDElementDeclaration element)
Returns a list of properties of the specified object. |
Object |
getProperty(Object object,
QName name)
Returns a property of a particular object which corresponds to the specified name. |
void |
initializeChildContext(ElementInstance childInstance,
Node node,
MutablePicoContainer context)
Initializes the context for a child element. |
Object |
parse(ElementInstance instance,
Node node,
Object value)
Parses a complex element from an instance document into an object representation. |
Methods inherited from interface Binding |
---|
getExecutionMode, getTarget, getType |
Method Detail |
---|
void initializeChildContext(ElementInstance childInstance, Node node, MutablePicoContainer context)
This method is called on the leading edge of a child element. It is used to create context for the binding of a child element. It is important to note that each time this method is called, the node parse tree will contain different, ie child nodes for those previous elements parsed.
childinstance
- The child element instancenode
- The parse node for the parent element.context
- the context in which the child element will be parsed.Object parse(ElementInstance instance, Node node, Object value) throws Exception
This method is called when the trailing edge of the associated element is reached.
instance
- The element being parsed.node
- The node in the parse tree representing the element being
parsed.value
- The result of the parse from another strategy in the type
hierarchy. Could be null if this is the first strategy being executed.
Exception
- Strategy objects should not attempt to handle any exceptions.Element encode(Object object, Document document, Element value) throws Exception
Complex objects are encoded as elements in a document. The value parameter is the encoded element, created by the parent binding. For the first binding in the execution chain this is just an empty element ( no children or attributes ). The binding has the choice to return value or to create a new element to return.
This method may choose to create child elements and attributes for the element.
Or as an alternative return the object values for these contructs in
getProperty(Object, QName)
.
object
- The object being encoded.document
- The document containing the encoded element.value
- The object as encoded by the parent binding.
null
Exception
Object getProperty(Object object, QName name) throws Exception
This method should just return null in the event that the object being encoded is an leaf in its object model.
For multi-values properties ( maxOccurs > 0 ), this method may return an
instance of Collection
, Iterator
, or
an array.
object
- The object being encoded.name
- The name of the property to obtain.
null
.
Exception
List getProperties(Object object) throws Exception
getProperties(Object, XSDElementDeclaration)
.
The return list contains a set of QName
, Object
tuples,
each as a two element object array.
This method should only be implemented in the case where the encoder can not determine what the properties of the object are from the schema.
An example would be an object which corresponds to an element in the
schema which has a the type xs:anyType
. Since the content
of this type can be anything the schema has no way to determine what
the properties are. So in this case this method must specify the
properties manually as a set of name, object tuples.
In the case of a multi-valued property, this method must return a tuple for each instance of the property, and not a list, iterator, or array containing all of the instances.
object
- the object being encoded.
Exception
List getProperties(Object object, XSDElementDeclaration element) throws Exception
The return list contains a set of tuples (two element object array) which represent the properties of the object. The second value is an object which respresents the value. The first value of the tuple can one of two things:
QName
identifying an element. This name will be used to locate the schema
element for the property.
XSDParticle
representing the element itself.
This method should only be implemented in the case where the encoder can not determine what the properties of the object are from the schema.
An example would be an object which corresponds to an element in the
schema which has a the type xs:anyType
. Since the content
of this type can be anything the schema has no way to determine what
the properties are. So in this case this method must specify the
properties manually as a set of name, object tuples.
In the case of a multi-valued property, this method must return a tuple for each instance of the property, and not a list, iterator, or array containing all of the instances.
object
- the object being encoded.element
-
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |