Package org.jibx.binding.def
Class MappingDefinition
java.lang.Object
org.jibx.binding.def.PassThroughComponent
org.jibx.binding.def.LinkableBase
org.jibx.binding.def.MappingBase
org.jibx.binding.def.MappingDefinition
- All Implemented Interfaces:
IComponent,ILinkable,IMapping
Normal mapping with defined binding. This is used for a mapping definition
which includes detailed binding information (rather than marshaller and
unmarshaller classes which handle the binding directly).
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final String(package private) static final String[]private static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Type[]private static final Stringprivate IMappingAbstract binding this one is based on (nullif not an extension).private final StringName of abstract base type.private final ObjectBindingBinding structure defining the mapping.private final BoundClassClass linked to mapping.private final IContainerContaining binding definition structure.private final DefinitionContextDefinition context for mapping.private ArrayListMappings which extend this one (nullif none).private final booleanAbstract mapping flag.private ClassFileConstructed marshaller class.private final NameDefinitionMapped element name (may benullif abstract mapping).private StringReference type of mapping, as fully qualified class name.private ClassFileConstructed unmarshaller class.private static final Type[]private static final Stringprivate static final Stringprivate static final String(package private) static final String[]private static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Type[]private static final Stringprivate static final Stringprivate static final String(package private) static final String[]private static final Stringprivate static final StringFields inherited from class org.jibx.binding.def.MappingBase
ABSTRACTMARSHALLER_INTERFACE, CHECKEXTENDS_FULLNAME, CHECKEXTENDS_METHODNAME, CHECKEXTENDS_SIGNATURE, GETINDEX_METHODNAME, GETINDEX_SIGNATURE, GETMARSHALLER_METHOD, GETMARSHALLER_SIGNATURE, GETNAME_METHODNAME, GETNAME_SIGNATURE, GETUNMARSHALLER_METHOD, GETUNMARSHALLER_SIGNATURE, IMARSHALLABLE_INTERFACE, IUNMARSHALLABLE_INTERFACE, MARSHALLABLE_METHODNAME, MARSHALLABLE_SIGNATURE, MARSHALLER_INTERFACE, MARSHALLERMARSHAL_METHOD, MARSHALLERMARSHAL_SIGNATURE, UNMARSHALLABLE_METHODNAME, UNMARSHALLABLE_SIGNATURE, UNMARSHALLER_INTERFACE, UNMARSHALLERUNMARSHAL_METHOD, UNMARSHALLERUNMARSHAL_SIGNATUREFields inherited from class org.jibx.binding.def.PassThroughComponent
m_component -
Constructor Summary
ConstructorsConstructorDescriptionMappingDefinition(IContainer contain, DefinitionContext defc, String type, NameDefinition name, String tname, boolean abs, String base, ObjectBinding bind, boolean nillable) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd extension to abstract mapping.voidAdd namespace.buildRef(IContainer parent, IContextObj objc, String type, PropertyDefinition prop) Build reference to mapping.private voidAdd abstract marshaller interface to handler class.voidgenerateCode(boolean force) Generate required code for mapping.private voidgenerateIfExtendingCheck(ClassFile cf, boolean hasname) Generate theIMarshaller.isExtension(String)method to check if this mapping is extending a particular abstract mapping.private voidgenerateIsPresent(ClassFile cf, boolean hasname) Generate theIUnmarshaller.isPresent(org.jibx.runtime.IUnmarshallingContext)method implementation.private voidgenerateMarshalImplementation(ClassFile cf, boolean hasattr, boolean hascont) Generate theIMarshaller.marshal(Object, org.jibx.runtime.IMarshallingContext)method implementation.private voidgenerateUnmarshalImplementation(ClassFile cf, boolean hasattr, boolean hascont, boolean hasname) Generate theIUnmarshaller.unmarshal(Object, org.jibx.runtime.IUnmarshallingContext)method implementation.(package private) voidGenerate code for loading namespace index and URI arrays.Get the actual binding for a mapping.Get the mapped class information.Get class name handled by mapping.Get binding component implementing mapping.Get marshaller class used for mapping.getName()Get mapped element name.Get namespaces defined for mapping.Get class name of type to be assumed for references to this mapping.Get unmarshaller class used for mapping.Get element wrapper name.(package private) booleanCheck if one or more namespaces are defined for element.booleanCheck if mapping is abstract.booleanisBase()Check if mapping has extensions.voidLinks extension mappings to their base mappings.voidprint(int depth) voidEstablish and validate linkages between binding components.Methods inherited from class org.jibx.binding.def.MappingBase
addIMarshallableMethod, addIUnmarshallableMethod, getMappingName, getTypeNameMethods inherited from class org.jibx.binding.def.LinkableBase
handleRecursion, isLinkedMethods inherited from class org.jibx.binding.def.PassThroughComponent
genAttributeMarshal, genAttributeUnmarshal, genAttrPresentTest, genContentMarshal, genContentPresentTest, genContentUnmarshal, genLoadId, genNewInstance, getType, hasAttribute, hasContent, hasId, isOptional, setWrappedComponent
-
Field Details
-
ADAPTERCLASS_SUFFIX
- See Also:
-
MARSHAL_METHODNAME
- See Also:
-
BASEMARSHAL_METHODNAME
- See Also:
-
UNMARSHAL_METHODNAME
- See Also:
-
ISPRESENT_METHODNAME
- See Also:
-
UNMARSHALCONTEXT_CLASS
- See Also:
-
MARSHALCONTEXT_CLASS
- See Also:
-
UNMARSHAL_ISATMETHOD
- See Also:
-
UNMARSHAL_ISATSIGNATURE
- See Also:
-
GETINDEX_METHOD
- See Also:
-
UNMARSHALLERPRESENT_METHOD
- See Also:
-
UNMARSHALLERPRESENT_SIGNATURE
- See Also:
-
UNMARSHALCONTEXT_INTERFACE
- See Also:
-
MARSHALCONTEXT_INTERFACE
- See Also:
-
CURRENTELEMENT_METHOD
- See Also:
-
CURRENTELEMENT_SIGNATURE
- See Also:
-
PARSERNEXT_METHOD
- See Also:
-
PARSERNEXT_SIGNATURE
- See Also:
-
CLOSESTART_METHOD
- See Also:
-
CLOSESTART_SIGNATURE
- See Also:
-
ADDUNMARSHALLER_METHOD
- See Also:
-
ADDUNMARSHALLER_SIGNATURE
- See Also:
-
REMOVEUNMARSHALLER_METHOD
- See Also:
-
REMOVEUNMARSHALLER_SIGNATURE
- See Also:
-
ADDMARSHALLER_METHOD
- See Also:
-
ADDMARSHALLER_SIGNATURE
- See Also:
-
REMOVEMARSHALLER_METHOD
- See Also:
-
REMOVEMARSHALLER_SIGNATURE
- See Also:
-
PUSH_NAMESPACES_METHOD
- See Also:
-
PUSH_NAMESPACES_SIG
- See Also:
-
POP_NAMESPACES_METHOD
- See Also:
-
POP_NAMESPACES_SIG
- See Also:
-
EQUALS_METHODNAME
- See Also:
-
EQUALS_SIGNATURE
- See Also:
-
ISPRESENT_METHOD_ARGS
private static final Type[] ISPRESENT_METHOD_ARGS -
UNMARSHAL_METHOD_ARGS
private static final Type[] UNMARSHAL_METHOD_ARGS -
MARSHAL_METHOD_ARGS
private static final Type[] MARSHAL_METHOD_ARGS -
UNMARSHALLER_INTERFACES
-
MARSHALLER_INTERFACES
-
BOTH_INTERFACES
-
m_container
Containing binding definition structure. -
m_defContext
Definition context for mapping. -
m_class
Class linked to mapping. -
m_name
Mapped element name (may benullif abstract mapping). -
m_isAbstract
private final boolean m_isAbstractAbstract mapping flag. -
m_baseType
Name of abstract base type. -
m_binding
Binding structure defining the mapping. -
m_baseMapping
Abstract binding this one is based on (nullif not an extension). -
m_marshaller
Constructed marshaller class. -
m_unmarshaller
Constructed unmarshaller class. -
m_extensions
Mappings which extend this one (nullif none). -
m_referenceType
Reference type of mapping, as fully qualified class name.
-
-
Constructor Details
-
MappingDefinition
public MappingDefinition(IContainer contain, DefinitionContext defc, String type, NameDefinition name, String tname, boolean abs, String base, ObjectBinding bind, boolean nillable) throws JiBXException Constructor.- Parameters:
contain- containing binding definition structuredefc- definition context for this mappingtype- bound class namename- mapped element name information (nullif none)tname- qualified type name for abstract mapping (nullif none)abs- abstract mapping flagbase- abstract mapping extended by this onebind- binding definition component (may benullif a concrete mapping)nillable- flag for nillable element- Throws:
JiBXException- if class definition not found
-
-
Method Details
-
hasNamespace
boolean hasNamespace()Check if one or more namespaces are defined for element.- Returns:
trueif namespaces are defined,falseif not
-
genLoadNamespaces
Generate code for loading namespace index and URI arrays.- Parameters:
mb- method builder for generated code
-
getBoundClass
Get the mapped class information. This implements the method used by the base class.- Specified by:
getBoundClassin classMappingBase- Returns:
- information for mapped class
-
linkMappings
Links extension mappings to their base mappings. This must be done before the more general linking step in order to determine which abstract mappings are standalone and which are extended by other mappings- Throws:
JiBXException- if error in linking
-
getBoundType
Description copied from interface:IMappingGet class name handled by mapping.- Returns:
- name of class bound by mapping
-
getReferenceType
Description copied from interface:IMappingGet class name of type to be assumed for references to this mapping.- Returns:
- reference type class name name
-
getImplComponent
Description copied from interface:IMappingGet binding component implementing mapping. This call is only valid for mappings with child components, not for mappings defined using marshallers or unmarshallers.- Returns:
- binding component implementing this mapping
-
getMarshaller
Description copied from interface:IMappingGet marshaller class used for mapping.- Returns:
- marshaller class information
-
getUnmarshaller
Description copied from interface:IMappingGet unmarshaller class used for mapping.- Returns:
- unmarshaller class information
-
getName
Description copied from interface:IMappingGet mapped element name.- Returns:
- mapped element name information (may be
nullif no element name defined for mapping)
-
addNamespace
Description copied from interface:IMappingAdd namespace. This adds a namespace definition to those active for the mapping.- Parameters:
ns- namespace definition to be added- Throws:
JiBXException- if error in defining namespace
-
isAbstract
public boolean isAbstract()Description copied from interface:IMappingCheck if mapping is abstract.- Returns:
trueif an abstract mapping,falseif not
-
isBase
public boolean isBase()Description copied from interface:IMappingCheck if mapping has extensions.- Returns:
trueif one or more mappings extend this mapping,falseif not
-
addExtension
Description copied from interface:IMappingAdd extension to abstract mapping. This call is only valid for abstract mappings.- Parameters:
mdef- extension mapping definition- Throws:
JiBXException- if configuration error
-
buildRef
public IComponent buildRef(IContainer parent, IContextObj objc, String type, PropertyDefinition prop) throws JiBXException Description copied from interface:IMappingBuild reference to mapping. Constructs and returns the component for handling the mapping.- Parameters:
parent- containing binding definition structureobjc- current object contexttype- mapped value typeprop- property definition (may benull)- Returns:
- constructed mapping reference component
- Throws:
JiBXException- if configuration error
-
getNamespaces
Description copied from interface:IMappingGet namespaces defined for mapping.- Returns:
- namespace definitions (may be
nullif none)
-
generateAbstractMarshaller
Add abstract marshaller interface to handler class. This adds the interface and generates theIAbstractMarshaller.baseMarshal(Object, org.jibx.runtime.IMarshallingContext)method responsible for passing handling on to the appropriate extension class.- Parameters:
cf- handler class
-
generateIfExtendingCheck
Generate theIMarshaller.isExtension(String)method to check if this mapping is extending a particular abstract mapping.- Parameters:
cf-hasname-
-
generateUnmarshalImplementation
private void generateUnmarshalImplementation(ClassFile cf, boolean hasattr, boolean hascont, boolean hasname) throws JiBXException Generate theIUnmarshaller.unmarshal(Object, org.jibx.runtime.IUnmarshallingContext)method implementation.- Parameters:
cf- class to receive methodhasattr- attribute definition present flaghascont- content definition present flaghasname- element name defined by this mapping flag- Throws:
JiBXException
-
generateIsPresent
Generate theIUnmarshaller.isPresent(org.jibx.runtime.IUnmarshallingContext)method implementation.- Parameters:
cf- class to receive methodhasname- element name defined by this mapping flag
-
generateMarshalImplementation
private void generateMarshalImplementation(ClassFile cf, boolean hasattr, boolean hascont) throws JiBXException Generate theIMarshaller.marshal(Object, org.jibx.runtime.IMarshallingContext)method implementation.- Parameters:
cf- class to receive methodhasattr- attribute definition present flaghascont- content definition present flag- Throws:
JiBXException
-
generateCode
Description copied from interface:IMappingGenerate required code for mapping.- Parameters:
force- add marshaller/unmarshaller classes for abstract non-base mappings flag (not passed on to children)- Throws:
JiBXException- if error in transformation
-
getWrapperName
Description copied from interface:IComponentGet element wrapper name. If the component defines an element as the container for content, this returns the name information for that element.- Specified by:
getWrapperNamein interfaceIComponent- Overrides:
getWrapperNamein classPassThroughComponent- Returns:
- component element name,
nullif no wrapper element
-
setLinkages
Description copied from interface:ILinkableEstablish and validate linkages between binding components. This is called after the basic binding structures have been set up. All linkages between components must be resolved by this method, in order to prevent problems due to the order of definitions between components. This implies that each component must in turn call the same method for each child component. None of the other method calls defined by this interface are valid until after this call.- Specified by:
setLinkagesin interfaceILinkable- Overrides:
setLinkagesin classLinkableBase- Throws:
JiBXException- if error in configuration
-
getBinding
Description copied from interface:IMappingGet the actual binding for a mapping. This is only usable with mappings defined by a binding; if the mapping is instead defined by specifying marshaller and unmarshaller classes this will just return null.- Returns:
- binding structure, or
nullif none
-
print
public void print(int depth) - Specified by:
printin interfaceIComponent- Overrides:
printin classLinkableBase
-