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 intBASE_USER_NAMESPACEFirst namespace index available for user definitions.private static java.lang.StringCLASSLIST_METHOD_NAMEprivate static java.lang.StringCLASSLIST_METHOD_SIGNATUREstatic java.lang.StringCURRENT_VERSION_NAMECurrent distribution file name.(package private) static java.lang.StringDEFAULT_AUTOPREFIXDefault prefix for automatic ID generation.private static java.lang.StringFACTORY_BASEprivate static java.lang.StringFACTORY_INSTNAMEprivate static java.lang.StringFACTORY_INTERFACEprivate static java.lang.String[]FACTORY_INTERFACESprivate static java.lang.StringFACTORY_SUFFIXprivate static java.lang.StringGETDISTRIB_METHODNAMEprivate static java.lang.StringGETINST_METHODNAMEprivate static java.lang.StringGETTYPEINDEX_METHODNAMEprivate static java.lang.StringGETVERSION_METHODNAMEprivate DefinitionContextm_activeContextInner definition context constructed for binding.private GrowableStringArraym_baseBindingFactoriesFactory class names for precompiled base bindings (same order as binding names).private GrowableStringArraym_baseBindingsPrecompiled base binding names used by this binding.private java.util.ArrayListm_baseHashesHashes for base binding factories (same order as binding names).private java.util.ArrayListm_baseNamespaceTablesNamespace index mapping tables for base bindings (same order as binding names).private GrowableStringArraym_closureFactoriesFactory classes for base bindings of base bindings.private java.util.ArrayListm_closureNamespaceTablesNamespace index mapping tables for base bindings of base bindings (same order as factories).private ArrayMapm_extraClassesClasses handled by in-line marshaller/unmarshaller references.private GrowableStringArraym_extraMarshallersMarshaller classes used in-line.private GrowableStringArraym_extraUnmarshallersUnmarshaller classes used in-line.private ClassFilem_factoryClassGenerated binding factory class.private java.lang.Stringm_factoryNameFully-qualified name of binding factory.private intm_highBasePrefixHigh mark in prefixes from from precompiled base bindings.private intm_indexIndex number of this binding.private booleanm_isAddConstructorsAdd default constructors where needed flag.private booleanm_isForceClassesGenerate marshaller/unmarshaller classes for top-level non-base abstract mappings flag.private booleanm_isForwardsSupport forward references to IDs flag.private booleanm_isIdGlobalUse global ID values flag.private booleanm_isInputInput binding flag.private booleanm_isMappedDoneFlag for done assigning indexes to mapped classes.private booleanm_isOutputOutput binding flag.private booleanm_isSchemaInstanceUsedFlag for schema instance namespace used in binding.private booleanm_isTrackSourceGenerate souce tracking interface flag.private intm_majorVersionMajor version of binding.private intm_minorVersionMinor version of binding.private intm_mumIndexNext index number for marshaller/unmarshaller slots used in-line.private java.lang.Stringm_nameBinding name.private GrowableStringArraym_namespacePrefixesOriginal prefixes for namespaces.private ArrayMapm_namespaceUrisNamespaces URIs included in binding.private DefinitionContextm_outerContextOuter definition context with default definitions.private java.lang.Stringm_targetPackagePackage for generated context factory.private java.io.Filem_targetRootFile root for generated context factory.private ArrayMapm_uniqueIdsClasses using unique (per class) identifiers.private static intMAX_STRING_LENGTH(package private) static QNameOBJECT_DEFAULT_NAMEName of object default conversion.private static intPRIVATESTATIC_ACCESSprivate static intPRIVATESTATICFINAL_ACCESSprivate static StringConversions_base64Conversionprivate static java.util.ArrayLists_bindingsTable of defined bindings.private static byte[]s_blanksprivate static StringConversions_booleanConversionprivate static StringConversions_byteConversionprivate static StringConversions_charConversionprivate static StringConversions_dateConversionprivate static StringConversions_doubleConversionprivate static StringConversions_floatConversionprivate static StringConversions_intConversionprivate static StringConversions_java5DecimalConversionprivate static StringConversions_jodaLocalDateConversionprivate static StringConversions_jodaLocalDateTimeConversionprivate static StringConversions_jodaLocalUnzonedDateMidnightConversionprivate static StringConversions_jodaStrictLocalDateTimeConversionprivate static StringConversions_jodaStrictUTCDateTimeConversionprivate static StringConversions_jodaUnzonedLocalTimeConversionprivate static StringConversions_jodaUnzonedUTCLocalTimeConversionprivate static StringConversions_jodaUTCDateMidnightConversionprivate static StringConversions_jodaUTCDateTimeConversionprivate static StringConversions_jodaZonedDateMidnightConversionprivate static StringConversions_jodaZonedDateTimeConversionprivate static StringConversions_longConversionprivate static ArrayMaps_mappedClassesClasses included in any binding.private static StringConversions_objectConversionprivate static StringConversions_qnameConversionprivate static StringConversions_shortConversionprivate static StringConversions_sqlDateConversionprivate static StringConversions_sqlTimeConversion(package private) static StringConversions_stringConversionprivate static StringConversions_timestampConversionprivate static StringConversions_wrappedBooleanConversionprivate static java.lang.StringSTRINGINT_MAPTYPEprivate static java.lang.StringSTRINGINTADD_METHODprivate static java.lang.StringSTRINGINTADD_SIGNATUREprivate static java.lang.StringSTRINGINTGET_METHODprivate static java.lang.StringSTRINGINTGET_SIGNATUREprivate static java.lang.StringSTRINGINTINIT_SIGNATUREprivate static intTYPEMAP_MINIMUM_SIZEMinimum size to use map for index from type name.private static java.lang.StringTYPEMAP_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 voidaddClassList(ClassFile[] adds, ClassFile[] keeps)Add the list of classes used by the binding compiler to the binding factory.voidaddMappingName(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.StringbuildClassNamesBlob(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.StringbuildClassNamesBlob(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.StringbuildIntsBlob(int[] ints)Convert an array of int values into a string blob.private static java.lang.StringbuildIntsBlob(java.util.List values)Convert a list ofIntegervalues into a string blob.private static java.lang.StringbuildNamesBlob(java.lang.String[] names)Build a name blob from an array of names.private static java.lang.StringbuildNamespaceIndexBlob(java.lang.String[] uris, java.lang.String[] nss)Build a namespace index blob from an array of namespace URIs.private static voidcodegenString(java.lang.String string, MethodBuilder mb)Generate code to load a string value, which may be longer than the maximum string length.private voidfixPrefixes()Fix the prefixes for namespaces imported from precompiled base bindings.voidgenerateCode(boolean verbose)Generate code.voidgenerateCode(boolean verbose1, boolean verbose2)Generate code.static BindingDefinitiongetBinding(int index)Get indexed binding.BindingDefinitiongetBindingRoot()Get root of binding definition.BoundClassgetBoundClass()Get class linked to binding element.java.lang.StringgetDefaultPackage()Get default package used for code generation.java.io.FilegetDefaultRoot()Get root directory for default code generation package.DefinitionContextgetDefinitionContext()Get definition context for binding element.java.lang.StringgetFactoryName()Get the fully-qualified name of the binding factory class for this binding.intgetIdClassIndex(java.lang.String name)Get index for ID'ed class from binding.intgetIndex()Get index number of binding.java.lang.StringgetMarshallerUnmarshallerName(java.lang.String clas)Get marshaller/unmarshaller name in binding.intgetNamespaceUriIndex(java.lang.String uri, java.lang.String prefix)Get index for namespace URI in binding.java.lang.StringgetPrefix()Get prefix for method or class generation.java.lang.StringgetPrefix(java.lang.String uri)Get the prefix assigned for a namespace.intgetStyleDefault()Get default style for value expression.booleanhasNamespaces()static voidindent(int depth)booleanisAddConstructors()Check if default constructor generation is enabled.booleanisContentOrdered()Check if content children are ordered.booleanisForwards()Check if forward ids are supported by unmarshalling binding.booleanisIdGlobal()Check if global ids are used by binding.booleanisInput()Check if binding is defined for unmarshalling.booleanisOutput()Check if binding is defined for marshalling.booleanisTrackSource()Check if source tracking is supported by unmarshalling binding.private static java.lang.StringmethodNameOrNull(ClassItem item)Convenience method to get an name, if the item is defined.voidprint()static voidreset()Discard cached information and reset in preparation for a new binding run.voidsetFactoryLocation(java.lang.String tpack, java.io.File root)Set location for binding factory class generation.booleansetIdChild(IComponent child)Set ID property.voidsetMarshallerUnmarshallerClasses(java.lang.String name, java.lang.String mclas, java.lang.String uclas)Set marshaller and unmarshaller class names.voidsetSchemaInstanceUsed()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 isnulland 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 JiBXExceptionConstructor. 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 ofIContainerinterface, just returnsnullin this case.- Returns:
- information for class linked by binding
-
getStyleDefault
public int getStyleDefault()
Get default style for value expression. Implementation ofIContainerinterface.- Specified by:
getStyleDefaultin interfaceIContainer- Overrides:
getStyleDefaultin 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:
trueif defined,falseif not
-
isOutput
public boolean isOutput()
Check if binding is defined for marshalling.- Returns:
trueif defined,falseif not
-
isIdGlobal
public boolean isIdGlobal()
Check if global ids are used by binding.- Returns:
trueif defined,falseif not
-
isForwards
public boolean isForwards()
Check if forward ids are supported by unmarshalling binding.- Returns:
trueif supported,falseif not
-
isTrackSource
public boolean isTrackSource()
Check if source tracking is supported by unmarshalling binding.- Returns:
trueif defined,falseif not
-
isAddConstructors
public boolean isAddConstructors()
Check if default constructor generation is enabled.- Returns:
trueif default constructor generation enabled,falseif 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 (
nullif 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.nullvalues 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 fornullvalues).- 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.nullvalues 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 ofIntegervalues 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 JiBXExceptionGenerate 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 JiBXExceptionGenerate code. This version preserves compatibility with the older form of the call, always passingfalsefor 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, ornullif none- Returns:
- item name, or
nullif 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:IContainerCheck if content children are ordered.- Specified by:
isContentOrderedin interfaceIContainer- Returns:
trueif ordered,falseif not
-
hasNamespaces
public boolean hasNamespaces()
-
getBindingRoot
public BindingDefinition getBindingRoot()
Description copied from interface:IContainerGet root of binding definition.- Specified by:
getBindingRootin interfaceIContainer- Returns:
- binding definition root
-
getDefinitionContext
public DefinitionContext getDefinitionContext()
Description copied from interface:IContainerGet definition context for binding element.- Specified by:
getDefinitionContextin interfaceIContainer- Returns:
- binding definition context
-
indent
public static void indent(int depth)
-
print
public void print()
-
-