Package org.jibx.runtime
Interface IBindingFactory
-
- All Known Implementing Classes:
BindingFactoryBase
public interface IBindingFactoryBinding 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 Summary
Fields Modifier and Type Field Description static intABMAP_ATTRMARMETH_INDEXAbstract mapping details index for attribute marshalling method.static intABMAP_ATTRPRESMETH_INDEXAbstract mapping details index for attribute presence test method.static intABMAP_ATTRUMARMETH_INDEXAbstract mapping details index for attribute unmarshalling method.static intABMAP_CLASSNAME_INDEXAbstract mapping details index for class name.static intABMAP_COMPLETEMETH_INDEXAbstract mapping details index for unmarshalling complete method.static intABMAP_CONTMARMETH_INDEXAbstract mapping details index for content marshalling method.static intABMAP_CONTPRESMETH_INDEXAbstract mapping details index for content presence test method.static intABMAP_CONTUMARMETH_INDEXAbstract mapping details index for content unmarshalling method.static intABMAP_COUNTNumber of abstract mapping details.static intABMAP_CREATEMETH_INDEXAbstract mapping details index for new instance creation method.static intABMAP_MAPPINGNAME_INDEXAbstract mapping details index for mapping (type or class) name.static intABMAP_PREPAREMETH_INDEXAbstract mapping details index for marshalling prepare method.static intCOMPATIBLE_VERSION_MASKMask for portions of version number that effect compatibility.static StringCURRENT_VERSION_NAMECurrent distribution file name.static intCURRENT_VERSION_NUMBERCurrent binary version number.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IMarshallingContextcreateMarshallingContext()Create marshalling context instance.IUnmarshallingContextcreateUnmarshallingContext()Create unmarshalling context instance.int[]getAbstractMappingNamespaces(int index)Get the indexes of the namespaces used by an abstract mapping.String[][]getAbstractMappings()Get the linkage information for global abstract mappings included in the binding.String[]getBaseBindingFactories()Get the names of the binding factory classes for the separately-compiled base bindings used by this binding.String[]getBaseBindings()Get the names of the separately-compiled base bindings used by this binding.String[]getBindingClasses()Get the classes used by the binding.StringgetBindingName()Get the name of this binding.StringIntHashMapgetClassIndexMap()Get map from fully-qualified class name to the index number of the class used for accessing the arrays of class names.StringgetCompilerDistribution()Get distribution name for binding compiler used.intgetCompilerVersion()Get version number for binding compiler used.String[]getElementNames()Get names of elements corresponding to mapped classes.String[]getElementNamespaces()Get namespaces of elements corresponding to mapped classes.intgetHash()Get hash for binding.intgetMajorVersion()Get the major version number for this binding.String[]getMappedClasses()Get mapped class names (or type names, in the case of abstract mappings).ClassgetMarshallerClass(int index)Get the marshaller class for a mapping.String[]getMarshallerClasses()Get marshaller class names.intgetMinorVersion()Get the minor version number for this binding.String[]getNamespaces()Get namespaces defined in mapping.MapgetNamespaceTranslationTableMap()Get a map from full-qualified binding factory names to an array ofintvalues used to convert namespace indexes in that binding to this binding.String[]getPrefixes()Get initial prefixes for namespaces defined in mapping.intgetTypeIndex(String type)Get mapped class index from type name for abstract non-base mappings included in the binding.ClassgetUnmarshallerClass(int index)Get the unmarshaller class for a mapping.String[]getUnmarshallerClasses()Get unmarshaller class names.MapgetUnmarshalMap()Get the mapping from element local name to class indexes.ClassloadClass(String name)Load a class.voidverifyBaseBindings()Verify that separately-compiled base bindings used by this binding can be loaded and are compatible with the base bindings used when this binding was compiled.
-
-
-
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 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
-
ABMAP_MAPPINGNAME_INDEX
static final int ABMAP_MAPPINGNAME_INDEX
Abstract mapping details index for mapping (type or class) name.- See Also:
- Constant Field Values
-
ABMAP_CLASSNAME_INDEX
static final int ABMAP_CLASSNAME_INDEX
Abstract mapping details index for class name.- See Also:
- Constant Field Values
-
ABMAP_CREATEMETH_INDEX
static final int ABMAP_CREATEMETH_INDEX
Abstract mapping details index for new instance creation method.- See Also:
- Constant Field Values
-
ABMAP_COMPLETEMETH_INDEX
static final int ABMAP_COMPLETEMETH_INDEX
Abstract mapping details index for unmarshalling complete method.- See Also:
- Constant Field Values
-
ABMAP_PREPAREMETH_INDEX
static final int ABMAP_PREPAREMETH_INDEX
Abstract mapping details index for marshalling prepare method.- See Also:
- Constant Field Values
-
ABMAP_ATTRPRESMETH_INDEX
static final int ABMAP_ATTRPRESMETH_INDEX
Abstract mapping details index for attribute presence test method.- See Also:
- Constant Field Values
-
ABMAP_ATTRUMARMETH_INDEX
static final int ABMAP_ATTRUMARMETH_INDEX
Abstract mapping details index for attribute unmarshalling method.- See Also:
- Constant Field Values
-
ABMAP_ATTRMARMETH_INDEX
static final int ABMAP_ATTRMARMETH_INDEX
Abstract mapping details index for attribute marshalling method.- See Also:
- Constant Field Values
-
ABMAP_CONTPRESMETH_INDEX
static final int ABMAP_CONTPRESMETH_INDEX
Abstract mapping details index for content presence test method.- See Also:
- Constant Field Values
-
ABMAP_CONTUMARMETH_INDEX
static final int ABMAP_CONTUMARMETH_INDEX
Abstract mapping details index for content unmarshalling method.- See Also:
- Constant Field Values
-
ABMAP_CONTMARMETH_INDEX
static final int ABMAP_CONTMARMETH_INDEX
Abstract mapping details index for content marshalling method.- See Also:
- Constant Field Values
-
ABMAP_COUNT
static final int ABMAP_COUNT
Number of abstract mapping details.- 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 contextUnsupportedOperationException- 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 contextUnsupportedOperationException- 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
String getCompilerDistribution()
Get distribution name for binding compiler used.- Returns:
- name of distribution for binding compiler
-
getBindingName
String getBindingName()
Get the name of this binding.- Returns:
- name
-
getMajorVersion
int getMajorVersion()
Get the major version number for this binding.- Returns:
- major version
-
getMinorVersion
int getMinorVersion()
Get the minor version number for this binding.- Returns:
- minor version
-
getHash
int getHash()
Get hash for binding. The computed hash value is based on all the values returned by all the methods of this interface, with the exception of thegetMarshallerClass(int)andgetUnmarshallerClass(int)methods returningClassobjects.- Returns:
- hash
-
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 (
nullif 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
(
nullif 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
-
getClassIndexMap
StringIntHashMap getClassIndexMap()
Get map from fully-qualified class name to the index number of the class used for accessing the arrays of class names. The value returned is the index for the class in the arrays returned bygetMappedClasses(),getMarshallerClasses(), andgetUnmarshallerClasses(), and can also be used as input forgetMarshallerClass(int)andgetUnmarshallerClass(int).- Returns:
- map from fully-qualified class name to index number
-
getElementNamespaces
String[] getElementNamespaces()
Get namespaces of elements corresponding to mapped classes. The returned array uses the same ordering as the result of thegetMappedClasses()call. Entries in the array arenullif 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 thegetMappedClasses()call. Entries in the array arenullif there is no element for a class.- Returns:
- array of element names
-
getMarshallerClasses
String[] getMarshallerClasses()
Get marshaller class names. The returned array uses the same ordering as the result of thegetMappedClasses()call. Entries in the array arenullif there is no marshaller class for the mapping.- Returns:
- array of class names
-
getUnmarshallerClasses
String[] getUnmarshallerClasses()
Get unmarshaller class names. The returned array uses the same ordering as the result of thegetMappedClasses()call. Entries in the array arenullif there is no unmarshaller class for the mapping.- Returns:
- array of class names
-
getTypeIndex
int getTypeIndex(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 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
-1if type is not an abstract non-base mapping
-
getBindingClasses
String[] getBindingClasses() throws JiBXException
Get the classes used by the binding. Every class which includes code generated by the binding compiler for this binding or any precompiled base binding is included in the returned array. IfverifyBaseBindings()has not already been invoked it will be invoked by this call.- Returns:
- fully-qualified class names
- Throws:
JiBXException- on base binding verification error
-
getAbstractMappings
String[][] getAbstractMappings()
Get the linkage information for global abstract mappings included in the binding. The returned array has a primary (first index) dimension of 11 and a secondary (second index) dimension equal to the number of global abstract mappings. The different index values for the first index give the following information:- 0 - mapping name (type or class)
- 1 - class name
- 2 - new instance creation method (
nullif none) - 3 - unmarshalling complete method (
nullif none) - 4 - prepare for marshalling method (
nullif none) - 5 - attribute presence test method (
nullif none) - 6 - attribute unmarshaller method (
nullif none) - 7 - attribute marshaller method (
nullif none) - 8 - content presence test method (
nullif none) - 9 - content unmarshaller method (
nullif none) - 10 - content marshaller method (
nullif none)
- Returns:
- method information array
-
getAbstractMappingNamespaces
int[] getAbstractMappingNamespaces(int index)
Get the indexes of the namespaces used by an abstract mapping.- Parameters:
index- abstract mapping index, corresponding to the abstract mapping information returned bygetAbstractMappings().- Returns:
- namespace indexes, empty array if none
-
getUnmarshalMap
Map getUnmarshalMap()
Get the mapping from element local name to class indexes. If a local name is only used with a single namespace, the value for that name is anIntegergiving the index of the class mapped to the name; if the local name is used with multiple namespaces, the value for that name is an array with multipleintclass indexes, for every class mapped to the name.- Returns:
- map from local name to class index array
-
getUnmarshallerClass
Class getUnmarshallerClass(int index)
Get the unmarshaller class for a mapping. This can only be used for global mappings.- Parameters:
index- unmarshaller class index- Returns:
- unmarshaller class, or
nullif unable to load class
-
getMarshallerClass
Class getMarshallerClass(int index)
Get the marshaller class for a mapping. This can only be used for global mappings.- Parameters:
index- marshaller class index- Returns:
- marshaller class, or
nullif unable to load class
-
getBaseBindings
String[] getBaseBindings()
Get the names of the separately-compiled base bindings used by this binding.- Returns:
- binding names
-
verifyBaseBindings
void verifyBaseBindings() throws JiBXExceptionVerify that separately-compiled base bindings used by this binding can be loaded and are compatible with the base bindings used when this binding was compiled.- Throws:
JiBXException- on verification failure
-
getBaseBindingFactories
String[] getBaseBindingFactories()
Get the names of the binding factory classes for the separately-compiled base bindings used by this binding.- Returns:
- binding factory fully-qualified class names
-
getNamespaceTranslationTableMap
Map getNamespaceTranslationTableMap()
Get a map from full-qualified binding factory names to an array ofintvalues used to convert namespace indexes in that binding to this binding. If the binding uses the same namespaces as this binding (or a subset of the same namespaces, with the same index values) there is no entry in the map.- Returns:
- map to namespace index translation
-
loadClass
Class loadClass(String name)
Load a class. This first tries to load the specified class using the classloader that loaded the binding factory instance, then tries the thread context classloader, then finally tries the classloader used to load core runtime classes.- Parameters:
name- fully qualified class name- Returns:
- loaded class, or
nullif class not found
-
-