Package org.jibx.v2

Interface BindingFactory


  • public interface BindingFactory
    Binding factory interface definition. This interface is implemented by the binding factory class generated by each binding definition. All binding factory instances are guaranteed to be threadsafe and reusable.
    Author:
    Dennis M. Sosnoski
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Object createElementInstance​(java.lang.String root, XmlReader rdr, java.lang.Object inst)
      Creat instance of class for element name.
      java.lang.Object createTypeInstance​(java.lang.String dflt, XmlReader rdr, java.lang.Object inst)
      Validate instance of class for type name.
      java.lang.String[] getElementNames()
      Get names of elements corresponding to mapped classes.
      java.lang.String[] getElementNamespaces()
      Get namespaces of elements corresponding to mapped classes.
      java.lang.String[] getMappedClasses()
      Get mapped class names (or type names, in the case of abstract mappings).
      java.lang.String[] getNamespaces()
      Get namespaces defined in mapping.
      java.lang.String[] getPrefixes()
      Get initial prefixes for namespaces defined in mapping.
    • Field Detail

      • CURRENT_VERSION_NUMBER

        static final int CURRENT_VERSION_NUMBER
        Current binary version number. This is a byte-ordered value, allowing for two levels of major and two levels of minor version.
        See Also:
        Constant Field Values
      • CURRENT_VERSION_NAME

        static final java.lang.String CURRENT_VERSION_NAME
        Current distribution file name. This is filled in by the Ant build process to match the current distribution.
        See Also:
        Constant Field Values
      • COMPATIBLE_VERSION_MASK

        static final int COMPATIBLE_VERSION_MASK
        Mask for portions of version number that effect compatibility.
        See Also:
        Constant Field Values
    • Method Detail

      • createElementInstance

        java.lang.Object createElementInstance​(java.lang.String root,
                                               XmlReader rdr,
                                               java.lang.Object inst)
        Creat instance of class for element name. This implements substitution group handling, by checking the current element start tag name against the expected element name, and if they're not the same finding the appropriate class based on the substitution group rooted on the expected element name (which must be a global element name).
        Parameters:
        root - global root element name, including namespace URI, in "lname{uri}" form
        rdr - reader
        inst - supplied instance of root element class or subclass (null if none)
        Returns:
        instance of appropriate class to use for unmarshalling (may be the same as the provided instance)
      • createTypeInstance

        java.lang.Object createTypeInstance​(java.lang.String dflt,
                                            XmlReader rdr,
                                            java.lang.Object inst)
        Validate instance of class for type name. This implements type substitution handling, by checking for an override xsi:type specification on the current element start tag, and if the type is different from the default finding the appropriate class and returning an instance.
        Parameters:
        dflt - global default complexType name, including namespace URI, in "lname{uri}" form
        rdr - reader
        inst - supplied instance of default type class or subclass (null if none)
        Returns:
        instance of appropriate class to use for unmarshalling (may be the same as the provided instance)
      • getNamespaces

        java.lang.String[] getNamespaces()
        Get namespaces defined in mapping. The returned array is indexed by the namespace index number used when marshalling.
        Returns:
        array of namespaces defined in binding (null if not an output binding)
      • getPrefixes

        java.lang.String[] getPrefixes()
        Get initial prefixes for namespaces defined in mapping. The returned array is indexed by the namespace index number used when marshalling. Note that these are only the first prefixes associated with each namespace; it's possible to reuse the namespace in the binding with a different prefix.
        Returns:
        array of prefixes for namespaces defined in binding (null if not an output binding)
      • getMappedClasses

        java.lang.String[] getMappedClasses()
        Get mapped class names (or type names, in the case of abstract mappings). Returns array of fully-qualified class and/or type names, ordered by index number of the class.
        Returns:
        array of class names
      • getElementNamespaces

        java.lang.String[] getElementNamespaces()
        Get namespaces of elements corresponding to mapped classes. The returned array uses the same ordering as the result of the getMappedClasses() call. Entries in the array are null if there is no element for a class or the element is in the default namespace.
        Returns:
        array of element namespaces
      • getElementNames

        java.lang.String[] getElementNames()
        Get names of elements corresponding to mapped classes. The returned array uses the same ordering as the result of the getMappedClasses() call. Entries in the array are null if there is no element for a class.
        Returns:
        array of element names