Package org.jibx.binding.def
Class MappingDirect
- java.lang.Object
-
- org.jibx.binding.def.PassThroughComponent
-
- org.jibx.binding.def.LinkableBase
-
- org.jibx.binding.def.MappingBase
-
- org.jibx.binding.def.MappingDirect
-
- All Implemented Interfaces:
IComponent,ILinkable,IMapping
public class MappingDirect extends MappingBase
Direct mapping using supplied marshaller and unmarshaller.- Author:
- Dennis M. Sosnoski
-
-
Field Summary
Fields Modifier and Type Field Description private BoundClassm_boundClassClass file to use for added code.private booleanm_isAbstractFlag for abstract mapping.private booleanm_isGeneratedFlag for code added to class (if appropriate).private DirectObjectm_mappingImplDirect mapping implementation.-
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 MappingDirect(IContainer contain, java.lang.String type, java.lang.String tname, DirectObject dir, boolean abs)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExtension(MappingDefinition mdef)Add extension to abstract mapping.voidaddNamespace(NamespaceDefinition ns)Add namespace.IComponentbuildRef(IContainer parent, IContextObj objc, java.lang.String type, PropertyDefinition prop)Build reference to mapping.voidgenerateCode(boolean force)Generate required code for mapping.ITypeBindinggetBinding()Get the actual binding for a mapping.BoundClassgetBoundClass()Get the mapped class information.java.lang.StringgetBoundType()Get class name handled by mapping.IComponentgetImplComponent()Get binding component implementing mapping.ClassFilegetMarshaller()Get marshaller class used for mapping.NameDefinitiongetName()Get mapped element name.java.util.ArrayListgetNamespaces()Get namespaces defined for mapping.java.lang.StringgetReferenceType()Get class name of type to be assumed for references to this mapping.ClassFilegetUnmarshaller()Get unmarshaller class used for mapping.NameDefinitiongetWrapperName()Get element wrapper name.booleanisAbstract()Check if mapping is abstract.booleanisBase()Check if mapping has extensions.voidprint(int depth)voidsetLinkages()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
-
-
-
-
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_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 Detail
-
MappingDirect
public MappingDirect(IContainer contain, java.lang.String type, java.lang.String tname, DirectObject dir, boolean abs) throws JiBXException
Constructor.- Parameters:
contain- containing binding definition structuretype- bound class nametname- qualified type name (nullif not specified)dir- direct object informationabs- abstract mapping flag- 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:
getBoundClassin classMappingBase- Returns:
- information for mapped class
-
getBoundType
public java.lang.String getBoundType()
Description copied from interface:IMappingGet class name handled by mapping.- Returns:
- name of class bound by mapping
-
getReferenceType
public java.lang.String 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
public IComponent 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
public ClassFile getMarshaller() throws JiBXException
Description copied from interface:IMappingGet 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:IMappingGet unmarshaller class used for mapping.- Returns:
- unmarshaller class information
- Throws:
JiBXException- if error in configuration
-
getName
public NameDefinition getName()
Description copied from interface:IMappingGet mapped element name.- Returns:
- mapped element name information (may be
nullif no element name defined for mapping)
-
addNamespace
public void addNamespace(NamespaceDefinition ns)
Description copied from interface:IMappingAdd 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: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
public void addExtension(MappingDefinition mdef)
Description copied from interface:IMappingAdd 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: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
public java.util.ArrayList getNamespaces()
Description copied from interface:IMappingGet namespaces defined for mapping.- Returns:
- namespace definitions (may be
nullif none)
-
generateCode
public void generateCode(boolean force) throws JiBXExceptionDescription 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
public NameDefinition 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
public void setLinkages() throws JiBXExceptionDescription 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
public ITypeBinding 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
-
-