Interface Type

    • Method Detail

      • getValue

        Object getValue​(Element element,
                        ElementValue[] value,
                        Attributes attrs,
                        Map<String,​Object> hints)
                 throws SAXException,
        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.

        See Also:
      • getName

        String getName()
        This returns the XML Schema declaration name of this type (both complex and simple types have names ...)
      • getNamespace

        URI getNamespace()
        This is used for validation of an XML document, and represents the targetNamespace of that this type resides in.
      • getInstanceType

        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.
      • canEncode

        boolean canEncode​(Element element,
                          Object value,
                          Map<String,​Object> hints)
        Can I write this object out as element specified?
        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.
        True when the encode method can interpret the given element/value pair into valid xml.
        See Also:
        Type#encode(Element, Object, Writer, Map)
      • encode

        void encode​(Element element,
                    Object value,
                    PrintHandler output,
                    Map<String,​Object> hints)
             throws IOException,
        Encode value as element on the provided output.

        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.
        IOException - When there is an error with the Writer.
        OperationNotSupportedException - When this type cannot be encoded ... and wasn't checked first.
      • findChildElement

        Element findChildElement​(String name)
        Convinience method used to search this type's children for the requested element by localName.
        name - the element's localName to search for.