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
public class MappingDefinition extends MappingBase
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
-
Fields 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_SIGNATURE
-
Fields inherited from class org.jibx.binding.def.PassThroughComponent
m_component
-
-
Constructor Summary
Constructors Constructor Description MappingDefinition(IContainer contain, DefinitionContext defc, String type, NameDefinition name, String tname, boolean abs, String base, ObjectBinding bind, boolean nillable)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExtension(MappingDefinition mdef)
Add extension to abstract mapping.void
addNamespace(NamespaceDefinition ns)
Add namespace.IComponent
buildRef(IContainer parent, IContextObj objc, String type, PropertyDefinition prop)
Build reference to mapping.void
generateCode(boolean force)
Generate required code for mapping.ITypeBinding
getBinding()
Get the actual binding for a mapping.BoundClass
getBoundClass()
Get the mapped class information.String
getBoundType()
Get class name handled by mapping.IComponent
getImplComponent()
Get binding component implementing mapping.ClassFile
getMarshaller()
Get marshaller class used for mapping.NameDefinition
getName()
Get mapped element name.ArrayList
getNamespaces()
Get namespaces defined for mapping.String
getReferenceType()
Get class name of type to be assumed for references to this mapping.ClassFile
getUnmarshaller()
Get unmarshaller class used for mapping.NameDefinition
getWrapperName()
Get element wrapper name.boolean
isAbstract()
Check if mapping is abstract.boolean
isBase()
Check if mapping has extensions.void
linkMappings()
Links extension mappings to their base mappings.void
print(int depth)
void
setLinkages()
Establish and validate linkages between binding components.-
Methods inherited from class org.jibx.binding.def.MappingBase
addIMarshallableMethod, addIUnmarshallableMethod, getMappingName, getTypeName
-
Methods inherited from class org.jibx.binding.def.LinkableBase
handleRecursion, isLinked
-
Methods inherited from class org.jibx.binding.def.PassThroughComponent
genAttributeMarshal, genAttributeUnmarshal, genAttrPresentTest, genContentMarshal, genContentPresentTest, genContentUnmarshal, genLoadId, genNewInstance, getType, hasAttribute, hasContent, hasId, isOptional, setWrappedComponent
-
-
-
-
Constructor Detail
-
MappingDefinition
public MappingDefinition(IContainer contain, DefinitionContext defc, String type, NameDefinition name, String tname, boolean abs, String base, ObjectBinding bind, boolean nillable) throws org.jibx.runtime.JiBXException
Constructor.- Parameters:
contain
- containing binding definition structuredefc
- definition context for this mappingtype
- bound class namename
- mapped element name information (null
if none)tname
- qualified type name for abstract mapping (null
if none)abs
- abstract mapping flagbase
- abstract mapping extended by this onebind
- binding definition component (may benull
if a concrete mapping)nillable
- flag for nillable element- Throws:
org.jibx.runtime.JiBXException
- if class definition not found
-
-
Method Detail
-
getBoundClass
public BoundClass getBoundClass()
Get the mapped class information. This implements the method used by the base class.- Specified by:
getBoundClass
in classMappingBase
- Returns:
- information for mapped class
-
linkMappings
public void linkMappings() throws org.jibx.runtime.JiBXException
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:
org.jibx.runtime.JiBXException
- if error in linking
-
getBoundType
public String getBoundType()
Description copied from interface:IMapping
Get class name handled by mapping.- Returns:
- name of class bound by mapping
-
getReferenceType
public String getReferenceType()
Description copied from interface:IMapping
Get class name of type to be assumed for references to this mapping.- Returns:
- reference type class name name
-
getImplComponent
public IComponent getImplComponent()
Description copied from interface:IMapping
Get 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
public ClassFile getMarshaller()
Description copied from interface:IMapping
Get marshaller class used for mapping.- Returns:
- marshaller class information
-
getUnmarshaller
public ClassFile getUnmarshaller()
Description copied from interface:IMapping
Get unmarshaller class used for mapping.- Returns:
- unmarshaller class information
-
getName
public NameDefinition getName()
Description copied from interface:IMapping
Get mapped element name.- Returns:
- mapped element name information (may be
null
if no element name defined for mapping)
-
addNamespace
public void addNamespace(NamespaceDefinition ns) throws org.jibx.runtime.JiBXException
Description copied from interface:IMapping
Add namespace. This adds a namespace definition to those active for the mapping.- Parameters:
ns
- namespace definition to be added- Throws:
org.jibx.runtime.JiBXException
- if error in defining namespace
-
isAbstract
public boolean isAbstract()
Description copied from interface:IMapping
Check if mapping is abstract.- Returns:
true
if an abstract mapping,false
if not
-
isBase
public boolean isBase()
Description copied from interface:IMapping
Check if mapping has extensions.- Returns:
true
if one or more mappings extend this mapping,false
if not
-
addExtension
public void addExtension(MappingDefinition mdef) throws org.jibx.runtime.JiBXException
Description copied from interface:IMapping
Add extension to abstract mapping. This call is only valid for abstract mappings.- Parameters:
mdef
- extension mapping definition- Throws:
org.jibx.runtime.JiBXException
- if configuration error
-
buildRef
public IComponent buildRef(IContainer parent, IContextObj objc, String type, PropertyDefinition prop) throws org.jibx.runtime.JiBXException
Description copied from interface:IMapping
Build 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:
org.jibx.runtime.JiBXException
- if configuration error
-
getNamespaces
public ArrayList getNamespaces()
Description copied from interface:IMapping
Get namespaces defined for mapping.- Returns:
- namespace definitions (may be
null
if none)
-
generateCode
public void generateCode(boolean force) throws org.jibx.runtime.JiBXException
Description copied from interface:IMapping
Generate required code for mapping.- Parameters:
force
- add marshaller/unmarshaller classes for abstract non-base mappings flag (not passed on to children)- Throws:
org.jibx.runtime.JiBXException
- if error in transformation
-
getWrapperName
public NameDefinition getWrapperName()
Description copied from interface:IComponent
Get element wrapper name. If the component defines an element as the container for content, this returns the name information for that element.- Specified by:
getWrapperName
in interfaceIComponent
- Overrides:
getWrapperName
in classPassThroughComponent
- Returns:
- component element name,
null
if no wrapper element
-
setLinkages
public void setLinkages() throws org.jibx.runtime.JiBXException
Description copied from interface:ILinkable
Establish 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:
setLinkages
in interfaceILinkable
- Overrides:
setLinkages
in classLinkableBase
- Throws:
org.jibx.runtime.JiBXException
- if error in configuration
-
getBinding
public ITypeBinding getBinding()
Description copied from interface:IMapping
Get 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
null
if none
-
print
public void print(int depth)
- Specified by:
print
in interfaceIComponent
- Overrides:
print
in classLinkableBase
-
-