org.jibx.binding.def
Class PrecompiledConcreteMapping

java.lang.Object
  extended by org.jibx.binding.def.PrecompiledConcreteMapping
All Implemented Interfaces:
ILinkable, IMapping

public class PrecompiledConcreteMapping
extends java.lang.Object
implements IMapping

Concrete mapping defined by a precompiled binding. This is constructed from the binding factory information for a binding which is referenced using a precompiled='true' attribute.

Author:
Dennis M. Sosnoski

Field Summary
private  ClassFile m_class
          Class linked to mapping.
private  IContainer m_container
          Containing context for definition.
private  java.lang.String m_mappingName
          Name of this mapping in binding..
private  ClassFile m_marshaller
          Marshaller class.
private  NameDefinition m_name
          Mapped element name.
private  ClassFile m_unmarshaller
          Unmarshaller class.
 
Constructor Summary
PrecompiledConcreteMapping(java.lang.String mapname, java.lang.String type, NameDefinition name, java.lang.String marname, java.lang.String umarname, IContainer parent)
          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.
 ITypeBinding getBinding()
          Get the actual binding for a mapping.
 java.lang.String getBoundType()
          Get class name handled by mapping.
 IComponent getImplComponent()
          Get binding component implementing mapping.
 java.lang.String getMappingName()
          Get the mapping name used in binding tables.
 ClassFile getMarshaller()
          Get marshaller class used for mapping.
 NameDefinition getName()
          Get mapped element name.
 java.util.ArrayList getNamespaces()
          Get namespaces defined for mapping.
 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.
 NameDefinition getWrapperName()
           
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_class

private final ClassFile m_class
Class linked to mapping.


m_mappingName

private final java.lang.String m_mappingName
Name of this mapping in binding..


m_name

private final NameDefinition m_name
Mapped element name.


m_container

private final IContainer m_container
Containing context for definition.


m_marshaller

private ClassFile m_marshaller
Marshaller class.


m_unmarshaller

private ClassFile m_unmarshaller
Unmarshaller class.

Constructor Detail

PrecompiledConcreteMapping

public PrecompiledConcreteMapping(java.lang.String mapname,
                                  java.lang.String type,
                                  NameDefinition name,
                                  java.lang.String marname,
                                  java.lang.String umarname,
                                  IContainer parent)
                           throws JiBXException
Constructor.

Parameters:
mapname - mapping name in binding
type - bound class name
name - element name definition
marname - marshaller class name (null if none)
umarname - unmarshaller class name (null if none)
parent - containing context
Throws:
JiBXException - if class definition not found
Method Detail

linkMappings

public void linkMappings()
                  throws JiBXException
Links extension mappings to their base mappings. For precompiled mappings this does nothing.

Throws:
JiBXException - if error in linking

getBoundType

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

Specified by:
getBoundType in interface IMapping
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.

Specified by:
getReferenceType in interface IMapping
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.

Specified by:
getImplComponent in interface IMapping
Returns:
binding component implementing this mapping

getMarshaller

public ClassFile getMarshaller()
Description copied from interface: IMapping
Get marshaller class used for mapping.

Specified by:
getMarshaller in interface IMapping
Returns:
marshaller class information

getUnmarshaller

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

Specified by:
getUnmarshaller in interface IMapping
Returns:
unmarshaller class information

getName

public NameDefinition getName()
Description copied from interface: IMapping
Get mapped element name.

Specified by:
getName in interface IMapping
Returns:
mapped element name information (may be null if no element name defined for mapping)

addNamespace

public void addNamespace(NamespaceDefinition ns)
                  throws JiBXException
Description copied from interface: IMapping
Add namespace. This adds a namespace definition to those active for the mapping.

Specified by:
addNamespace in interface IMapping
Parameters:
ns - namespace definition to be added
Throws:
JiBXException - if error in defining namespace

isAbstract

public boolean isAbstract()
Description copied from interface: IMapping
Check if mapping is abstract.

Specified by:
isAbstract in interface IMapping
Returns:
true if an abstract mapping, false if not

isBase

public boolean isBase()
Description copied from interface: IMapping
Check if mapping has extensions.

Specified by:
isBase in interface IMapping
Returns:
true if one or more mappings extend this mapping, false if not

addExtension

public void addExtension(MappingDefinition mdef)
                  throws JiBXException
Description copied from interface: IMapping
Add extension to abstract mapping. This call is only valid for abstract mappings.

Specified by:
addExtension in interface IMapping
Parameters:
mdef - extension mapping definition
Throws:
JiBXException - if configuration error

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.

Specified by:
buildRef in interface IMapping
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

getNamespaces

public java.util.ArrayList getNamespaces()
Description copied from interface: IMapping
Get namespaces defined for mapping.

Specified by:
getNamespaces in interface IMapping
Returns:
namespace definitions (may be null if none)

generateCode

public void generateCode(boolean force)
                  throws JiBXException
Description copied from interface: IMapping
Generate required code for mapping.

Specified by:
generateCode in interface IMapping
Parameters:
force - add marshaller/unmarshaller classes for abstract non-base mappings flag (not passed on to children)
Throws:
JiBXException - if error in transformation

getWrapperName

public NameDefinition getWrapperName()

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.

Specified by:
getBinding in interface IMapping
Returns:
binding structure, or null if none

getMappingName

public java.lang.String getMappingName()
Description copied from interface: IMapping
Get the mapping name used in binding tables.

Specified by:
getMappingName in interface IMapping
Returns:
name

getTypeName

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

Specified by:
getTypeName in interface IMapping
Returns:
qualified type name, in text form (null if unnamed)

setLinkages

public void setLinkages()
                 throws 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 interface ILinkable
Throws:
JiBXException - if error in configuration

print

public void print(int depth)


Project Web Site