|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This is a convinience interface to help speed up the code, allowing for any type definition to handled in a consistent manner, independant of whether it's nested or not.
SimpleType
,
ComplexType
Method Summary | |
boolean |
canEncode(Element element,
java.lang.Object value,
java.util.Map hints)
Can I write this object out as element specified? |
void |
encode(Element element,
java.lang.Object value,
PrintHandler output,
java.util.Map hints)
Encode value as element on the provided output. |
Element |
findChildElement(java.lang.String name)
Convinience method used to search this type's children for the requested element by localName. |
java.lang.Class |
getInstanceType()
This will return the intended Java Class for this element type. |
java.lang.String |
getName()
This returns the XML Schema declaration name of this type (both complex and simple types have names ...) |
java.net.URI |
getNamespace()
This is used for validation of an XML document, and represents the targetNamespace of that this type resides in. |
java.lang.Object |
getValue(Element element,
ElementValue[] value,
org.xml.sax.Attributes attrs,
java.util.Map hints)
This method is intended to receive the child elements in the form of ElementValues (@see ElementValue). |
Method Detail |
public java.lang.Object getValue(Element element, ElementValue[] value, org.xml.sax.Attributes attrs, java.util.Map hints) throws org.xml.sax.SAXException, javax.naming.OperationNotSupportedException
This method is intended to receive the child elements in the form of ElementValues (@see ElementValue). Recall that this is a pairing containing a reference to the type and the actual value (do not call .getValue on the types). This should return the real value (interpreted value) for this element based on it's children. Remember, this is a XML is a tree structure, so if you don't include some children, they are gone forever (so be careful when ignoring data).
If the element had #CData (Nested Child Text), this will appear in the first slot, with a null Element.
A SAXNotSupportedException should be thrown when the child's [inherited, default implementation of getValue(ElementValue[],Attributes)] method should be used.
javax.naming.OperationNotSupportedException
org.xml.sax.SAXException
ElementValue
public java.lang.String getName()
This returns the XML Schema declaration name of this type (both complex and simple types have names ...)
public java.net.URI getNamespace()
This is used for validation of an XML document, and represents the targetNamespace of that this type resides in.
public java.lang.Class getInstanceType()
This will return the intended Java Class for this element type. For generic complex types this will be an object array. SimpleTypes will match as they are parsed, and custom extensions will also return the appropriate class value.
public boolean canEncode(Element element, java.lang.Object value, java.util.Map hints)
element
- The element which may be used to represent the Object. This is included to allow for child definitions to include addition information where appropriate.value
- An Object which may or may not be encodeable by this type. The value may also be null.
Type#encode(Element, Object, Writer, Map)
public void encode(Element element, java.lang.Object value, PrintHandler output, java.util.Map hints) throws java.io.IOException, javax.naming.OperationNotSupportedException
This is encoding because the PrintHandler does not have to go back to a stream.
element
- The original element declaration to which we should encode.value
- The Object to encode.output
- This is where the output should be written to.hints
- For providing additional context information to specific schemas.
java.io.IOException
- When there is an error with the Writer.
javax.naming.OperationNotSupportedException
- When this type cannot be encoded ... and wasn't checked first.public Element findChildElement(java.lang.String name)
name
- the element's localName to search for.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |