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
  • Field Details

    • 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:
    • CURRENT_VERSION_NAME

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

      static final int COMPATIBLE_VERSION_MASK
      Mask for portions of version number that effect compatibility.
      See Also:
  • Method Details

    • createElementInstance

      Object createElementInstance(String root, XmlReader rdr, 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

      Object createTypeInstance(String dflt, XmlReader rdr, 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

      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

      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

      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

      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

      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