Class MappingDirect

All Implemented Interfaces:
IComponent, ILinkable, IMapping

public class MappingDirect extends MappingBase
Direct mapping using supplied marshaller and unmarshaller.
Author:
Dennis M. Sosnoski
  • Field Details

    • 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_isAbstract

      private final boolean m_isAbstract
      Flag for abstract mapping.
    • m_isGenerated

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

    • MappingDirect

      public MappingDirect(IContainer contain, String type, String tname, DirectObject dir, boolean abs) throws JiBXException
      Constructor.
      Parameters:
      contain - containing binding definition structure
      type - bound class name
      tname - qualified type name (null if not specified)
      dir - direct object information
      abs - abstract mapping flag
      Throws:
      JiBXException - on mapping definition conflict
  • Method Details

    • 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 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() 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)
    • 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, 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
    • 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 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
    • 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 interface IComponent
      Overrides:
      getWrapperName in class PassThroughComponent
      Returns:
      component element name, null if no wrapper element
    • 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
      Overrides:
      setLinkages in class LinkableBase
      Throws:
      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 interface IComponent
      Overrides:
      print in class LinkableBase