Package org.jibx.binding.def
Class BindingDefinition
- java.lang.Object
-
- org.jibx.binding.def.BindingBuilder.ContainerBase
-
- org.jibx.binding.def.BindingDefinition
-
- All Implemented Interfaces:
IContainer
public class BindingDefinition extends BindingBuilder.ContainerBase implements IContainer
Binding definition. This is the root of the object graph for a binding.- Author:
- Dennis M. Sosnoski
-
-
Field Summary
Fields Modifier and Type Field Description static int
BASE_USER_NAMESPACE
First namespace index available for user definitions.private static java.lang.String
CLASSLIST_METHOD_NAME
private static java.lang.String
CLASSLIST_METHOD_SIGNATURE
static java.lang.String
CURRENT_VERSION_NAME
Current distribution file name.(package private) static java.lang.String
DEFAULT_AUTOPREFIX
Default prefix for automatic ID generation.private static java.lang.String
FACTORY_BASE
private static java.lang.String
FACTORY_INSTNAME
private static java.lang.String
FACTORY_INTERFACE
private static java.lang.String[]
FACTORY_INTERFACES
private static java.lang.String
FACTORY_SUFFIX
private static java.lang.String
GETDISTRIB_METHODNAME
private static java.lang.String
GETINST_METHODNAME
private static java.lang.String
GETTYPEINDEX_METHODNAME
private static java.lang.String
GETVERSION_METHODNAME
private DefinitionContext
m_activeContext
Inner definition context constructed for binding.private GrowableStringArray
m_baseBindingFactories
Factory class names for precompiled base bindings (same order as binding names).private GrowableStringArray
m_baseBindings
Precompiled base binding names used by this binding.private java.util.ArrayList
m_baseHashes
Hashes for base binding factories (same order as binding names).private java.util.ArrayList
m_baseNamespaceTables
Namespace index mapping tables for base bindings (same order as binding names).private GrowableStringArray
m_closureFactories
Factory classes for base bindings of base bindings.private java.util.ArrayList
m_closureNamespaceTables
Namespace index mapping tables for base bindings of base bindings (same order as factories).private ArrayMap
m_extraClasses
Classes handled by in-line marshaller/unmarshaller references.private GrowableStringArray
m_extraMarshallers
Marshaller classes used in-line.private GrowableStringArray
m_extraUnmarshallers
Unmarshaller classes used in-line.private ClassFile
m_factoryClass
Generated binding factory class.private java.lang.String
m_factoryName
Fully-qualified name of binding factory.private int
m_highBasePrefix
High mark in prefixes from from precompiled base bindings.private int
m_index
Index number of this binding.private boolean
m_isAddConstructors
Add default constructors where needed flag.private boolean
m_isForceClasses
Generate marshaller/unmarshaller classes for top-level non-base abstract mappings flag.private boolean
m_isForwards
Support forward references to IDs flag.private boolean
m_isIdGlobal
Use global ID values flag.private boolean
m_isInput
Input binding flag.private boolean
m_isMappedDone
Flag for done assigning indexes to mapped classes.private boolean
m_isOutput
Output binding flag.private boolean
m_isSchemaInstanceUsed
Flag for schema instance namespace used in binding.private boolean
m_isTrackSource
Generate souce tracking interface flag.private int
m_majorVersion
Major version of binding.private int
m_minorVersion
Minor version of binding.private int
m_mumIndex
Next index number for marshaller/unmarshaller slots used in-line.private java.lang.String
m_name
Binding name.private GrowableStringArray
m_namespacePrefixes
Original prefixes for namespaces.private ArrayMap
m_namespaceUris
Namespaces URIs included in binding.private DefinitionContext
m_outerContext
Outer definition context with default definitions.private java.lang.String
m_targetPackage
Package for generated context factory.private java.io.File
m_targetRoot
File root for generated context factory.private ArrayMap
m_uniqueIds
Classes using unique (per class) identifiers.private static int
MAX_STRING_LENGTH
(package private) static QName
OBJECT_DEFAULT_NAME
Name of object default conversion.private static int
PRIVATESTATIC_ACCESS
private static int
PRIVATESTATICFINAL_ACCESS
private static StringConversion
s_base64Conversion
private static java.util.ArrayList
s_bindings
Table of defined bindings.private static byte[]
s_blanks
private static StringConversion
s_booleanConversion
private static StringConversion
s_byteConversion
private static StringConversion
s_charConversion
private static StringConversion
s_dateConversion
private static StringConversion
s_doubleConversion
private static StringConversion
s_floatConversion
private static StringConversion
s_intConversion
private static StringConversion
s_java5DecimalConversion
private static StringConversion
s_jodaLocalDateConversion
private static StringConversion
s_jodaLocalDateTimeConversion
private static StringConversion
s_jodaLocalUnzonedDateMidnightConversion
private static StringConversion
s_jodaStrictLocalDateTimeConversion
private static StringConversion
s_jodaStrictUTCDateTimeConversion
private static StringConversion
s_jodaUnzonedLocalTimeConversion
private static StringConversion
s_jodaUnzonedUTCLocalTimeConversion
private static StringConversion
s_jodaUTCDateMidnightConversion
private static StringConversion
s_jodaUTCDateTimeConversion
private static StringConversion
s_jodaZonedDateMidnightConversion
private static StringConversion
s_jodaZonedDateTimeConversion
private static StringConversion
s_longConversion
private static ArrayMap
s_mappedClasses
Classes included in any binding.private static StringConversion
s_objectConversion
private static StringConversion
s_qnameConversion
private static StringConversion
s_shortConversion
private static StringConversion
s_sqlDateConversion
private static StringConversion
s_sqlTimeConversion
(package private) static StringConversion
s_stringConversion
private static StringConversion
s_timestampConversion
private static StringConversion
s_wrappedBooleanConversion
private static java.lang.String
STRINGINT_MAPTYPE
private static java.lang.String
STRINGINTADD_METHOD
private static java.lang.String
STRINGINTADD_SIGNATURE
private static java.lang.String
STRINGINTGET_METHOD
private static java.lang.String
STRINGINTGET_SIGNATURE
private static java.lang.String
STRINGINTINIT_SIGNATURE
private static int
TYPEMAP_MINIMUM_SIZE
Minimum size to use map for index from type name.private static java.lang.String
TYPEMAP_NAME
-
Fields inherited from class org.jibx.binding.def.BindingBuilder.ContainerBase
m_accessLevel, m_autoLink, m_container, m_nameStyle, m_stripPrefix, m_stripSuffix, m_styleDefault
-
-
Constructor Summary
Constructors Constructor Description BindingDefinition(java.lang.String name, boolean ibind, boolean obind, java.lang.String tpack, boolean glob, boolean forward, boolean source, boolean force, boolean add, boolean trim, int major, int minor)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addClassList(ClassFile[] adds, ClassFile[] keeps)
Add the list of classes used by the binding compiler to the binding factory.void
addMappingName(java.lang.String name)
Add mapping name to binding.int[]
addPrecompiledBinding(IBindingFactory factory, int major, int minor)
Add a precompiled binding reference to this binding.private static java.lang.String
buildClassNamesBlob(java.lang.String[] names)
Build a class or method name blob from an array of fully-qualified class and/or method names.private static java.lang.String
buildClassNamesBlob(java.util.List names)
Build a class or method name blob from a list of fully-qualified class and/or method names.private static java.lang.String
buildIntsBlob(int[] ints)
Convert an array of int values into a string blob.private static java.lang.String
buildIntsBlob(java.util.List values)
Convert a list ofInteger
values into a string blob.private static java.lang.String
buildNamesBlob(java.lang.String[] names)
Build a name blob from an array of names.private static java.lang.String
buildNamespaceIndexBlob(java.lang.String[] uris, java.lang.String[] nss)
Build a namespace index blob from an array of namespace URIs.private static void
codegenString(java.lang.String string, MethodBuilder mb)
Generate code to load a string value, which may be longer than the maximum string length.private void
fixPrefixes()
Fix the prefixes for namespaces imported from precompiled base bindings.void
generateCode(boolean verbose)
Generate code.void
generateCode(boolean verbose1, boolean verbose2)
Generate code.static BindingDefinition
getBinding(int index)
Get indexed binding.BindingDefinition
getBindingRoot()
Get root of binding definition.BoundClass
getBoundClass()
Get class linked to binding element.java.lang.String
getDefaultPackage()
Get default package used for code generation.java.io.File
getDefaultRoot()
Get root directory for default code generation package.DefinitionContext
getDefinitionContext()
Get definition context for binding element.java.lang.String
getFactoryName()
Get the fully-qualified name of the binding factory class for this binding.int
getIdClassIndex(java.lang.String name)
Get index for ID'ed class from binding.int
getIndex()
Get index number of binding.java.lang.String
getMarshallerUnmarshallerName(java.lang.String clas)
Get marshaller/unmarshaller name in binding.int
getNamespaceUriIndex(java.lang.String uri, java.lang.String prefix)
Get index for namespace URI in binding.java.lang.String
getPrefix()
Get prefix for method or class generation.java.lang.String
getPrefix(java.lang.String uri)
Get the prefix assigned for a namespace.int
getStyleDefault()
Get default style for value expression.boolean
hasNamespaces()
static void
indent(int depth)
boolean
isAddConstructors()
Check if default constructor generation is enabled.boolean
isContentOrdered()
Check if content children are ordered.boolean
isForwards()
Check if forward ids are supported by unmarshalling binding.boolean
isIdGlobal()
Check if global ids are used by binding.boolean
isInput()
Check if binding is defined for unmarshalling.boolean
isOutput()
Check if binding is defined for marshalling.boolean
isTrackSource()
Check if source tracking is supported by unmarshalling binding.private static java.lang.String
methodNameOrNull(ClassItem item)
Convenience method to get an name, if the item is defined.void
print()
static void
reset()
Discard cached information and reset in preparation for a new binding run.void
setFactoryLocation(java.lang.String tpack, java.io.File root)
Set location for binding factory class generation.boolean
setIdChild(IComponent child)
Set ID property.void
setMarshallerUnmarshallerClasses(java.lang.String name, java.lang.String mclas, java.lang.String uclas)
Set marshaller and unmarshaller class names.void
setSchemaInstanceUsed()
Set flag for schema instance namespace used in binding.-
Methods inherited from class org.jibx.binding.def.BindingBuilder.ContainerBase
unmarshal
-
-
-
-
Field Detail
-
OBJECT_DEFAULT_NAME
static final QName OBJECT_DEFAULT_NAME
Name of object default conversion.
-
BASE_USER_NAMESPACE
public static final int BASE_USER_NAMESPACE
First namespace index available for user definitions.- See Also:
- Constant Field Values
-
CURRENT_VERSION_NAME
public 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
-
DEFAULT_AUTOPREFIX
static final java.lang.String DEFAULT_AUTOPREFIX
Default prefix for automatic ID generation.- See Also:
- Constant Field Values
-
TYPEMAP_MINIMUM_SIZE
private static final int TYPEMAP_MINIMUM_SIZE
Minimum size to use map for index from type name.- See Also:
- Constant Field Values
-
s_bindings
private static java.util.ArrayList s_bindings
Table of defined bindings.
-
s_mappedClasses
private static ArrayMap s_mappedClasses
Classes included in any binding.
-
s_byteConversion
private static final StringConversion s_byteConversion
-
s_charConversion
private static final StringConversion s_charConversion
-
s_doubleConversion
private static final StringConversion s_doubleConversion
-
s_floatConversion
private static final StringConversion s_floatConversion
-
s_intConversion
private static final StringConversion s_intConversion
-
s_longConversion
private static final StringConversion s_longConversion
-
s_shortConversion
private static final StringConversion s_shortConversion
-
s_booleanConversion
private static final StringConversion s_booleanConversion
-
s_dateConversion
private static final StringConversion s_dateConversion
-
s_sqlDateConversion
private static final StringConversion s_sqlDateConversion
-
s_sqlTimeConversion
private static final StringConversion s_sqlTimeConversion
-
s_timestampConversion
private static final StringConversion s_timestampConversion
-
s_jodaLocalDateConversion
private static final StringConversion s_jodaLocalDateConversion
-
s_jodaZonedDateMidnightConversion
private static final StringConversion s_jodaZonedDateMidnightConversion
-
s_jodaLocalUnzonedDateMidnightConversion
private static final StringConversion s_jodaLocalUnzonedDateMidnightConversion
-
s_jodaUTCDateMidnightConversion
private static final StringConversion s_jodaUTCDateMidnightConversion
-
s_jodaUnzonedLocalTimeConversion
private static final StringConversion s_jodaUnzonedLocalTimeConversion
-
s_jodaUnzonedUTCLocalTimeConversion
private static final StringConversion s_jodaUnzonedUTCLocalTimeConversion
-
s_jodaZonedDateTimeConversion
private static final StringConversion s_jodaZonedDateTimeConversion
-
s_jodaUTCDateTimeConversion
private static final StringConversion s_jodaUTCDateTimeConversion
-
s_jodaLocalDateTimeConversion
private static final StringConversion s_jodaLocalDateTimeConversion
-
s_jodaStrictLocalDateTimeConversion
private static final StringConversion s_jodaStrictLocalDateTimeConversion
-
s_jodaStrictUTCDateTimeConversion
private static final StringConversion s_jodaStrictUTCDateTimeConversion
-
s_java5DecimalConversion
private static final StringConversion s_java5DecimalConversion
-
s_base64Conversion
private static final StringConversion s_base64Conversion
-
s_wrappedBooleanConversion
private static final StringConversion s_wrappedBooleanConversion
-
s_qnameConversion
private static final StringConversion s_qnameConversion
-
s_stringConversion
static final StringConversion s_stringConversion
-
s_objectConversion
private static final StringConversion s_objectConversion
-
FACTORY_SUFFIX
private static final java.lang.String FACTORY_SUFFIX
- See Also:
- Constant Field Values
-
FACTORY_INTERFACE
private static final java.lang.String FACTORY_INTERFACE
- See Also:
- Constant Field Values
-
FACTORY_BASE
private static final java.lang.String FACTORY_BASE
- See Also:
- Constant Field Values
-
FACTORY_INTERFACES
private static final java.lang.String[] FACTORY_INTERFACES
-
FACTORY_INSTNAME
private static final java.lang.String FACTORY_INSTNAME
- See Also:
- Constant Field Values
-
PRIVATESTATIC_ACCESS
private static final int PRIVATESTATIC_ACCESS
-
PRIVATESTATICFINAL_ACCESS
private static final int PRIVATESTATICFINAL_ACCESS
-
TYPEMAP_NAME
private static final java.lang.String TYPEMAP_NAME
- See Also:
- Constant Field Values
-
GETINST_METHODNAME
private static final java.lang.String GETINST_METHODNAME
- See Also:
- Constant Field Values
-
GETVERSION_METHODNAME
private static final java.lang.String GETVERSION_METHODNAME
- See Also:
- Constant Field Values
-
GETDISTRIB_METHODNAME
private static final java.lang.String GETDISTRIB_METHODNAME
- See Also:
- Constant Field Values
-
GETTYPEINDEX_METHODNAME
private static final java.lang.String GETTYPEINDEX_METHODNAME
- See Also:
- Constant Field Values
-
STRINGINT_MAPTYPE
private static final java.lang.String STRINGINT_MAPTYPE
- See Also:
- Constant Field Values
-
STRINGINTINIT_SIGNATURE
private static final java.lang.String STRINGINTINIT_SIGNATURE
- See Also:
- Constant Field Values
-
STRINGINTADD_METHOD
private static final java.lang.String STRINGINTADD_METHOD
- See Also:
- Constant Field Values
-
STRINGINTADD_SIGNATURE
private static final java.lang.String STRINGINTADD_SIGNATURE
- See Also:
- Constant Field Values
-
STRINGINTGET_METHOD
private static final java.lang.String STRINGINTGET_METHOD
- See Also:
- Constant Field Values
-
STRINGINTGET_SIGNATURE
private static final java.lang.String STRINGINTGET_SIGNATURE
- See Also:
- Constant Field Values
-
MAX_STRING_LENGTH
private static final int MAX_STRING_LENGTH
- See Also:
- Constant Field Values
-
CLASSLIST_METHOD_NAME
private static final java.lang.String CLASSLIST_METHOD_NAME
- See Also:
- Constant Field Values
-
CLASSLIST_METHOD_SIGNATURE
private static final java.lang.String CLASSLIST_METHOD_SIGNATURE
- See Also:
- Constant Field Values
-
m_name
private final java.lang.String m_name
Binding name.
-
m_index
private final int m_index
Index number of this binding.
-
m_isInput
private final boolean m_isInput
Input binding flag.
-
m_isOutput
private final boolean m_isOutput
Output binding flag.
-
m_isIdGlobal
private final boolean m_isIdGlobal
Use global ID values flag.
-
m_isForwards
private final boolean m_isForwards
Support forward references to IDs flag.
-
m_isTrackSource
private final boolean m_isTrackSource
Generate souce tracking interface flag.
-
m_isForceClasses
private final boolean m_isForceClasses
Generate marshaller/unmarshaller classes for top-level non-base abstract mappings flag.
-
m_majorVersion
private final int m_majorVersion
Major version of binding.
-
m_minorVersion
private final int m_minorVersion
Minor version of binding.
-
m_isAddConstructors
private boolean m_isAddConstructors
Add default constructors where needed flag.
-
m_targetPackage
private java.lang.String m_targetPackage
Package for generated context factory.
-
m_targetRoot
private java.io.File m_targetRoot
File root for generated context factory.
-
m_factoryName
private java.lang.String m_factoryName
Fully-qualified name of binding factory.
-
m_uniqueIds
private ArrayMap m_uniqueIds
Classes using unique (per class) identifiers. This isnull
and unused when using global ID values.
-
m_namespaceUris
private ArrayMap m_namespaceUris
Namespaces URIs included in binding.
-
m_namespacePrefixes
private GrowableStringArray m_namespacePrefixes
Original prefixes for namespaces.
-
m_highBasePrefix
private int m_highBasePrefix
High mark in prefixes from from precompiled base bindings.
-
m_outerContext
private DefinitionContext m_outerContext
Outer definition context with default definitions.
-
m_activeContext
private DefinitionContext m_activeContext
Inner definition context constructed for binding.
-
m_isMappedDone
private boolean m_isMappedDone
Flag for done assigning indexes to mapped classes.
-
m_isSchemaInstanceUsed
private boolean m_isSchemaInstanceUsed
Flag for schema instance namespace used in binding.
-
m_mumIndex
private int m_mumIndex
Next index number for marshaller/unmarshaller slots used in-line.
-
m_extraClasses
private ArrayMap m_extraClasses
Classes handled by in-line marshaller/unmarshaller references.
-
m_extraMarshallers
private GrowableStringArray m_extraMarshallers
Marshaller classes used in-line.
-
m_extraUnmarshallers
private GrowableStringArray m_extraUnmarshallers
Unmarshaller classes used in-line.
-
m_baseBindings
private GrowableStringArray m_baseBindings
Precompiled base binding names used by this binding.
-
m_baseBindingFactories
private GrowableStringArray m_baseBindingFactories
Factory class names for precompiled base bindings (same order as binding names).
-
m_baseHashes
private java.util.ArrayList m_baseHashes
Hashes for base binding factories (same order as binding names).
-
m_baseNamespaceTables
private java.util.ArrayList m_baseNamespaceTables
Namespace index mapping tables for base bindings (same order as binding names).
-
m_closureFactories
private GrowableStringArray m_closureFactories
Factory classes for base bindings of base bindings.
-
m_closureNamespaceTables
private java.util.ArrayList m_closureNamespaceTables
Namespace index mapping tables for base bindings of base bindings (same order as factories).
-
m_factoryClass
private ClassFile m_factoryClass
Generated binding factory class.
-
s_blanks
private static byte[] s_blanks
-
-
Constructor Detail
-
BindingDefinition
public BindingDefinition(java.lang.String name, boolean ibind, boolean obind, java.lang.String tpack, boolean glob, boolean forward, boolean source, boolean force, boolean add, boolean trim, int major, int minor) throws JiBXException
Constructor. Sets all defaults, including the default name provided, and initializes the definition context for the outermost level of the binding.- Parameters:
name
- binding nameibind
- input binding flagobind
- output binding flagtpack
- target packageglob
- global IDs flagforward
- support forward referenced IDs flagsource
- add source tracking for unmarshalled objects flagforce
- create marshaller/unmarshaller classes for top-level non-base mappingsadd
- add default constructors where necessary flagtrim
- trim whitespace from simple values before conversion flagmajor
- major version numberminor
- minor version number- Throws:
JiBXException
- if error in transformation
-
-
Method Detail
-
getBoundClass
public BoundClass getBoundClass()
Get class linked to binding element. Implementation ofIContainer
interface, just returnsnull
in this case.- Returns:
- information for class linked by binding
-
getStyleDefault
public int getStyleDefault()
Get default style for value expression. Implementation ofIContainer
interface.- Specified by:
getStyleDefault
in interfaceIContainer
- Overrides:
getStyleDefault
in classBindingBuilder.ContainerBase
- Returns:
- default style type for values
-
setIdChild
public boolean setIdChild(IComponent child)
Set ID property. This parent binding component interface method should never be called for the binding definition, and will throw a runtime exception if it is called.- Parameters:
child
- child defining the ID property- Returns:
false
-
getDefaultPackage
public java.lang.String getDefaultPackage()
Get default package used for code generation.- Returns:
- default code generation package
-
getDefaultRoot
public java.io.File getDefaultRoot()
Get root directory for default code generation package.- Returns:
- root for default code generation
-
setFactoryLocation
public void setFactoryLocation(java.lang.String tpack, java.io.File root)
Set location for binding factory class generation.- Parameters:
tpack
- target package for generated context factoryroot
- target root for generated context factory
-
getIndex
public int getIndex()
Get index number of binding.- Returns:
- index number for this binding definition
-
isInput
public boolean isInput()
Check if binding is defined for unmarshalling.- Returns:
true
if defined,false
if not
-
isOutput
public boolean isOutput()
Check if binding is defined for marshalling.- Returns:
true
if defined,false
if not
-
isIdGlobal
public boolean isIdGlobal()
Check if global ids are used by binding.- Returns:
true
if defined,false
if not
-
isForwards
public boolean isForwards()
Check if forward ids are supported by unmarshalling binding.- Returns:
true
if supported,false
if not
-
isTrackSource
public boolean isTrackSource()
Check if source tracking is supported by unmarshalling binding.- Returns:
true
if defined,false
if not
-
isAddConstructors
public boolean isAddConstructors()
Check if default constructor generation is enabled.- Returns:
true
if default constructor generation enabled,false
if not
-
getPrefix
public java.lang.String getPrefix()
Get prefix for method or class generation.- Returns:
- prefix for names created by this binding
-
addMappingName
public void addMappingName(java.lang.String name)
Add mapping name to binding. If the name is not already included in any binding it is first added to the list of mapping names. This method is intended for use with <mapping> definitions. It is an error to call this method after calling thegetMarshallerUnmarshallerName(java.lang.String)
method.- Parameters:
name
- mapping name (type name if given, otherwise the fully qualified mapped class name)
-
getMarshallerUnmarshallerName
public java.lang.String getMarshallerUnmarshallerName(java.lang.String clas)
Get marshaller/unmarshaller name in binding. The same class may have more than one marshaller/unmarshaller pair defined, so this uses the supplied class name as a base and appends a numeric suffix as necessary to generate a unique name. After the name has been assigned by this method, thesetMarshallerUnmarshallerClasses(java.lang.String, java.lang.String, java.lang.String)
method must be used to set the actual class names.- Parameters:
clas
- fully qualified name of class handled by marshaller/unmarshaller- Returns:
- unique name for marshaller/unmarshaller pair
-
setMarshallerUnmarshallerClasses
public void setMarshallerUnmarshallerClasses(java.lang.String name, java.lang.String mclas, java.lang.String uclas)
Set marshaller and unmarshaller class names.- Parameters:
name
- assigned marshaller/unmarshaller namemclas
- fully qualified name of marshaller classuclas
- fully qualified name of unmarshaller class
-
getIdClassIndex
public int getIdClassIndex(java.lang.String name)
Get index for ID'ed class from binding. If the class is not already included it is first added to the binding. If globally unique IDs are used this always returns0
.- Parameters:
name
- fully qualified name of ID'ed class- Returns:
- index number of class
-
getNamespaceUriIndex
public int getNamespaceUriIndex(java.lang.String uri, java.lang.String prefix)
Get index for namespace URI in binding. If the URI is not already included it is first added to the binding. The empty namespace URI is always given index number0
.- Parameters:
uri
- namespace URI to be included in bindingprefix
- prefix used with namespace- Returns:
- index number of namespace
-
setSchemaInstanceUsed
public void setSchemaInstanceUsed()
Set flag for schema instance namespace used in binding.
-
addPrecompiledBinding
public int[] addPrecompiledBinding(IBindingFactory factory, int major, int minor)
Add a precompiled binding reference to this binding. This records the reference and makes sure that all the namespaces used in the precompiled binding are defined in this binding, also generating a namespace index mapping table if this binding supports output and the indexes differ.- Parameters:
factory
- actual binding factory for precompiled bindingmajor
- required major version numberminor
- required minor version number- Returns:
- namespace index translation table (
null
if none)
-
fixPrefixes
private void fixPrefixes()
Fix the prefixes for namespaces imported from precompiled base bindings. If there are no namespaces from precompiled base bindings, or these namespaces use prefixes which are unique from each other and from those used in this binding, nothing is done. If there are conflicts or namespaces used without prefixes this sets unique prefixes for each namespace.
-
getPrefix
public java.lang.String getPrefix(java.lang.String uri)
Get the prefix assigned for a namespace. This is intended mainly for use with precompiled bindings, where thefixPrefixes()
method may change the initial prefixes (if any) in order to avoid conflicts.- Parameters:
uri
- namespace URI- Returns:
- prefix for namespace
-
buildClassNamesBlob
private static java.lang.String buildClassNamesBlob(java.lang.String[] names)
Build a class or method name blob from an array of fully-qualified class and/or method names. The returned string consists of compacted fully-qualified names separated by '|' delimiter characters. If some number of package (and potentially class) name levels are the same as the last name, these components are replaced with simple '.' characters (and '$' characters, in the case of class name components) in the compacted name.null
values are represented as empty names.- Parameters:
names
- fully-qualified class and/or method names list- Returns:
- compacted name blob
-
buildClassNamesBlob
private static java.lang.String buildClassNamesBlob(java.util.List names)
Build a class or method name blob from a list of fully-qualified class and/or method names. This just converts the list to an array and delegates tobuildClassNamesBlob(String[])
.- Parameters:
names
- fully-qualified class and/or method names list- Returns:
- compacted name blob
-
buildNamespaceIndexBlob
private static java.lang.String buildNamespaceIndexBlob(java.lang.String[] uris, java.lang.String[] nss)
Build a namespace index blob from an array of namespace URIs. The returned string consists of one character per namespace, giving the index of the namespace URI within the array of definitions, biased by +2 to avoid use of null characters (with +1 used fornull
values).- Parameters:
uris
- table of namespaces defined in bindingnss
- namespaces for index blob- Returns:
- index blob
-
buildNamesBlob
private static java.lang.String buildNamesBlob(java.lang.String[] names)
Build a name blob from an array of names. The returned string consists of names separated by '|' delimiter characters.null
values are represented as empty names.- Parameters:
names
- names for blob- Returns:
- name blob
-
buildIntsBlob
private static java.lang.String buildIntsBlob(int[] ints)
Convert an array of int values into a string blob.- Parameters:
ints
-- Returns:
- string with int values as characters
-
buildIntsBlob
private static java.lang.String buildIntsBlob(java.util.List values)
Convert a list ofInteger
values into a string blob. This is just a convenience wrapper forbuildIntsBlob(int[])
.- Parameters:
values
-- Returns:
- string with int values as characters
-
codegenString
private static void codegenString(java.lang.String string, MethodBuilder mb)
Generate code to load a string value, which may be longer than the maximum string length. This either loads the string directly (if within the limit) or recreates it by concatenating two or more shorter strings.- Parameters:
string
-mb
-
-
getFactoryName
public java.lang.String getFactoryName()
Get the fully-qualified name of the binding factory class for this binding.- Returns:
- class name
-
generateCode
public void generateCode(boolean verbose1, boolean verbose2) throws JiBXException
Generate code. First sets linkages and executes code generation for each top-level mapping defined in this binding, which in turn propagates the code generation all the way down. Then generates the actual binding factory for this binding.- Parameters:
verbose1
- flag for verbose output from first passverbose2
- flag for verbose output from second pass- Throws:
JiBXException
- if error in code generation
-
generateCode
public void generateCode(boolean verbose) throws JiBXException
Generate code. This version preserves compatibility with the older form of the call, always passingfalse
for the second-pass verbose flag. SeegenerateCode(boolean, boolean)
for details of processing.- Parameters:
verbose
- flag for verbose output from first pass- Throws:
JiBXException
- if error in code generation
-
addClassList
public void addClassList(ClassFile[] adds, ClassFile[] keeps)
Add the list of classes used by the binding compiler to the binding factory. This needs to be done as a separate step after the normal binding process has completed in order to make sure that the full set of classes is available. Ugly, but necessary because the class handling doesn't finalize newly-generated class names until they're actually written (too much sophistication, in retrospect).- Parameters:
adds
- classes added by bindingkeeps
- classes used but kept unchanged by binding
-
methodNameOrNull
private static java.lang.String methodNameOrNull(ClassItem item)
Convenience method to get an name, if the item is defined.- Parameters:
item
- information, ornull
if none- Returns:
- item name, or
null
if no item
-
getBinding
public static BindingDefinition getBinding(int index)
Get indexed binding.- Parameters:
index
- number of binding to be returned- Returns:
- binding at the specified index
-
reset
public static void reset()
Discard cached information and reset in preparation for a new binding run.
-
isContentOrdered
public boolean isContentOrdered()
Description copied from interface:IContainer
Check if content children are ordered.- Specified by:
isContentOrdered
in interfaceIContainer
- Returns:
true
if ordered,false
if not
-
hasNamespaces
public boolean hasNamespaces()
-
getBindingRoot
public BindingDefinition getBindingRoot()
Description copied from interface:IContainer
Get root of binding definition.- Specified by:
getBindingRoot
in interfaceIContainer
- Returns:
- binding definition root
-
getDefinitionContext
public DefinitionContext getDefinitionContext()
Description copied from interface:IContainer
Get definition context for binding element.- Specified by:
getDefinitionContext
in interfaceIContainer
- Returns:
- binding definition context
-
indent
public static void indent(int depth)
-
print
public void print()
-
-