org.jibx.runtime
Interface IBindingFactory


public interface IBindingFactory

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.

Version:
1.0
Author:
Dennis M. Sosnoski

Field Summary
static int COMPATIBLE_VERSION_MASK
          Mask for portions of version number that effect compatibility.
static java.lang.String CURRENT_VERSION_NAME
          Current distribution file name.
static int CURRENT_VERSION_NUMBER
          Current binary version number.
 
Method Summary
 IMarshallingContext createMarshallingContext()
          Create marshalling context instance.
 IUnmarshallingContext createUnmarshallingContext()
          Create unmarshalling context instance.
 java.lang.String getCompilerDistribution()
          Get distribution name for binding compiler used.
 int getCompilerVersion()
          Get version number for binding compiler used.
 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.
 int getTypeIndex(java.lang.String type)
          Get mapped class index from type name for abstract non-base mappings included in the binding.
 

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

createMarshallingContext

IMarshallingContext createMarshallingContext()
                                             throws JiBXException
Create marshalling context instance.

Returns:
created marshalling context instance
Throws:
JiBXException - if error creating context
java.lang.UnsupportedOperationException - if marshalling not supported by binding

createUnmarshallingContext

IUnmarshallingContext createUnmarshallingContext()
                                                 throws JiBXException
Create unmarshalling context instance.

Returns:
created unmarshalling context instance
Throws:
JiBXException - if error creating context
java.lang.UnsupportedOperationException - if unmarshalling not supported by binding

getCompilerVersion

int getCompilerVersion()
Get version number for binding compiler used.

Returns:
version number of code used to compile binding

getCompilerDistribution

java.lang.String getCompilerDistribution()
Get distribution name for binding compiler used.

Returns:
name of distribution for binding compiler

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

getTypeIndex

int getTypeIndex(java.lang.String type)
Get mapped class index from type name for abstract non-base mappings included in the binding. This is intended to allow identifying and using abstract mappings (basically type mappings) at runtime. The method is only returns a non-negative result if the "force-classes" option is used for the binding definition (since otherwise no marshaller/unmarshaller classes are created for abstract non-base mappings).

Parameters:
type - fully-qualified class or type name
Returns:
mapping index for type, or -1 if type is not an abstract non-base mapping


Project Web Site