org.jibx.binding.def
Class MappingDirect

java.lang.Object
  extended by org.jibx.binding.def.PassThroughComponent
      extended by org.jibx.binding.def.LinkableBase
          extended by org.jibx.binding.def.MappingBase
              extended by org.jibx.binding.def.MappingDirect
All Implemented Interfaces:
IComponent, IMapping

public class MappingDirect
extends MappingBase

Direct mapping using supplied marshaller and unmarshaller.

Version:
1.0
Author:
Dennis M. Sosnoski

Field Summary
private  BoundClass m_boundClass
          Class file to use for added code.
private  boolean m_isGenerated
          Flag for code added to class (if appropriate).
private  DirectObject m_mappingImpl
          Direct mapping implementation.
 
Fields inherited from class org.jibx.binding.def.MappingBase
ABSTRACTMARSHALLER_INTERFACE, CHECKEXTENDS_METHODNAME, CHECKEXTENDS_SIGNATURE, GETINDEX_METHODNAME, GETINDEX_SIGNATURE, GETMARSHALLER_METHOD, GETMARSHALLER_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
MappingDirect(IContainer contain, java.lang.String type, DirectObject dir)
          Constructor.
 
Method Summary
 void addExtension(MappingDefinition mdef)
          Add extension to abstract mapping.
 void addNamespace(NamespaceDefinition ns)
          Add namespace.
 IComponent buildRef(IContainer parent, IContextObj objc, java.lang.String type, PropertyDefinition prop)
          Build reference to mapping.
 void generateCode(boolean force)
          Generate required code for mapping.
 BoundClass getBoundClass()
          Get the mapped class information.
 java.lang.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.
 java.lang.String getReferenceType()
          Get class name of type to be assumed for references to this mapping.
 java.lang.String getTypeName()
          Get type name.
 ClassFile getUnmarshaller()
          Get unmarshaller class used for mapping.
 boolean isAbstract()
          Check if mapping is abstract.
 boolean isBase()
          Check if mapping has extensions.
 void print(int depth)
           
 void setLinkages()
          Establish and validate linkages between binding components.
 
Methods inherited from class org.jibx.binding.def.MappingBase
addIMarshallableMethod, addIUnmarshallableMethod, getIndex
 
Methods inherited from class org.jibx.binding.def.LinkableBase
handleRecursion
 
Methods inherited from class org.jibx.binding.def.PassThroughComponent
checkContentSequence, genAttributeMarshal, genAttributeUnmarshal, genAttrPresentTest, genContentMarshal, genContentPresentTest, genContentUnmarshal, genLoadId, genNewInstance, getType, hasAttribute, hasContent, hasId, isOptional, setWrappedComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jibx.binding.def.IComponent
checkContentSequence, genAttributeMarshal, genAttributeUnmarshal, genAttrPresentTest, genContentMarshal, genContentPresentTest, genContentUnmarshal, genLoadId, genNewInstance, getType, hasAttribute, hasContent, hasId, isOptional
 

Field Detail

m_mappingImpl

private final DirectObject m_mappingImpl
Direct mapping implementation.


m_boundClass

private final BoundClass m_boundClass
Class file to use for added code.


m_isGenerated

private boolean m_isGenerated
Flag for code added to class (if appropriate).

Constructor Detail

MappingDirect

public MappingDirect(IContainer contain,
                     java.lang.String type,
                     DirectObject dir)
              throws JiBXException
Constructor.

Parameters:
contain - containing binding definition structure
type - bound class name
dir - direct object information
Throws:
JiBXException - on mapping definition conflict
Method Detail

getBoundClass

public BoundClass getBoundClass()
Get the mapped class information. This implements the method used by the base class.

Specified by:
getBoundClass in class MappingBase
Returns:
information for mapped class

getBoundType

public java.lang.String getBoundType()
Description copied from interface: IMapping
Get class name handled by mapping.

Returns:
name of class bound by mapping

getReferenceType

public java.lang.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()
                        throws JiBXException
Description copied from interface: IMapping
Get marshaller class used for mapping.

Returns:
marshaller class information
Throws:
JiBXException - if error in configuration

getUnmarshaller

public ClassFile getUnmarshaller()
                          throws JiBXException
Description copied from interface: IMapping
Get unmarshaller class used for mapping.

Returns:
unmarshaller class information
Throws:
JiBXException - if error in configuration

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)

getTypeName

public java.lang.String getTypeName()
Description copied from interface: IMapping
Get type name.

Returns:
type name (null if unnamed)

addNamespace

public void addNamespace(NamespaceDefinition ns)
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

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)
Description copied from interface: IMapping
Add extension to abstract mapping. This call is only valid for abstract mappings.

Parameters:
mdef - extension mapping definition

buildRef

public IComponent buildRef(IContainer parent,
                           IContextObj objc,
                           java.lang.String type,
                           PropertyDefinition prop)
                    throws JiBXException
Description copied from interface: IMapping
Build reference to mapping. Constructs and returns the component for handling the mapping.

Parameters:
parent - containing binding definition structure
objc - current object context
type - mapped value type
prop - property definition (may be null)
Returns:
constructed mapping reference component
Throws:
JiBXException - if configuration error

generateCode

public void generateCode(boolean force)
                  throws 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:
JiBXException - if error in transformation

setLinkages

public void setLinkages()
                 throws JiBXException
Description copied from interface: IComponent
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 interface IComponent
Overrides:
setLinkages in class LinkableBase
Throws:
JiBXException - if error in configuration

print

public void print(int depth)
Specified by:
print in interface IComponent
Overrides:
print in class LinkableBase


Project Web Site