Package org.jibx.binding.def
Class PrecompiledAbstractMapping
- java.lang.Object
-
- org.jibx.binding.def.PrecompiledAbstractMapping
-
public class PrecompiledAbstractMapping extends java.lang.Object implements IMapping
Abstract 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
Fields Modifier and Type Field Description private PrecompiledBindingm_bindingBinding structure defining the mapping.private ClassFilem_classClass linked to mapping.private java.lang.Stringm_mappingNameName used for mapping in binding tables.private java.util.ArrayListm_namespacesNamespaces used by this mapping.private IContainerm_parentContaining context for definition.private java.lang.Stringm_referenceTypeReference type of mapping, as fully qualified class name.private booleanm_translatedNamespace index translation required flag.private java.lang.Stringm_typeNameQualified type name.
-
Constructor Summary
Constructors Constructor Description PrecompiledAbstractMapping(java.lang.String type, java.lang.String tname, java.lang.String mapname, int index, IBindingFactory factory, int[] nsxlate, IContainer parent)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.java.lang.StringgetBoundType()Get class name handled by mapping.IComponentgetImplComponent()Get binding component implementing mapping.java.lang.StringgetMappingName()Get the mapping name used in binding tables.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.java.lang.StringgetTypeName()Get type name.ClassFilegetUnmarshaller()Get unmarshaller class used for mapping.NameDefinitiongetWrapperName()booleanisAbstract()Check if mapping is abstract.booleanisBase()Check if mapping has extensions.voidlinkMappings()Links extension mappings to their base mappings.voidprint(int depth)voidsetLinkages()Establish and validate linkages between binding components.
-
-
-
Field Detail
-
m_translated
private final boolean m_translated
Namespace index translation required flag.
-
m_class
private final ClassFile m_class
Class linked to mapping.
-
m_typeName
private final java.lang.String m_typeName
Qualified type name.
-
m_binding
private final PrecompiledBinding m_binding
Binding structure defining the mapping.
-
m_referenceType
private final java.lang.String m_referenceType
Reference type of mapping, as fully qualified class name.
-
m_namespaces
private final java.util.ArrayList m_namespaces
Namespaces used by this mapping.
-
m_parent
private final IContainer m_parent
Containing context for definition.
-
m_mappingName
private final java.lang.String m_mappingName
Name used for mapping in binding tables.
-
-
Constructor Detail
-
PrecompiledAbstractMapping
public PrecompiledAbstractMapping(java.lang.String type, java.lang.String tname, java.lang.String mapname, int index, IBindingFactory factory, int[] nsxlate, IContainer parent) throws JiBXExceptionConstructor.- Parameters:
type- bound class nametname- qualified type name for abstract mapping (nullif none)mapname- abstract mapping name in bindingindex- abstract mapping index in bindingfactory- binding factory for mapping informationnsxlate- namespace index translation table (nullif none)parent- containing context- Throws:
JiBXException- if class definition not found
-
-
Method Detail
-
linkMappings
public void linkMappings() throws JiBXExceptionLinks 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:IMappingGet class name handled by mapping.- Specified by:
getBoundTypein interfaceIMapping- 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.- Specified by:
getReferenceTypein interfaceIMapping- 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.- Specified by:
getImplComponentin interfaceIMapping- Returns:
- binding component implementing this mapping
-
getMarshaller
public ClassFile getMarshaller()
Description copied from interface:IMappingGet marshaller class used for mapping.- Specified by:
getMarshallerin interfaceIMapping- Returns:
- marshaller class information
-
getUnmarshaller
public ClassFile getUnmarshaller()
Description copied from interface:IMappingGet unmarshaller class used for mapping.- Specified by:
getUnmarshallerin interfaceIMapping- Returns:
- unmarshaller class information
-
getName
public NameDefinition getName()
Description copied from interface:IMappingGet mapped element name.
-
addNamespace
public void addNamespace(NamespaceDefinition ns) throws JiBXException
Description copied from interface:IMappingAdd namespace. This adds a namespace definition to those active for the mapping.- Specified by:
addNamespacein interfaceIMapping- Parameters:
ns- namespace definition to be added- Throws:
JiBXException- if error in defining namespace
-
isAbstract
public boolean isAbstract()
Description copied from interface:IMappingCheck if mapping is abstract.- Specified by:
isAbstractin interfaceIMapping- Returns:
trueif an abstract mapping,falseif not
-
isBase
public boolean isBase()
Description copied from interface:IMappingCheck if mapping has extensions.
-
addExtension
public void addExtension(MappingDefinition mdef) throws JiBXException
Description copied from interface:IMappingAdd extension to abstract mapping. This call is only valid for abstract mappings.- Specified by:
addExtensionin interfaceIMapping- 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:IMappingBuild reference to mapping. Constructs and returns the component for handling the mapping.- Specified by:
buildRefin interfaceIMapping- 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.- Specified by:
getNamespacesin interfaceIMapping- Returns:
- namespace definitions (may be
nullif none)
-
generateCode
public void generateCode(boolean force) throws JiBXExceptionDescription copied from interface:IMappingGenerate required code for mapping.- Specified by:
generateCodein interfaceIMapping- 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: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.- Specified by:
getBindingin interfaceIMapping- Returns:
- binding structure, or
nullif none
-
getMappingName
public java.lang.String getMappingName()
Description copied from interface:IMappingGet the mapping name used in binding tables.- Specified by:
getMappingNamein interfaceIMapping- Returns:
- name
-
getTypeName
public java.lang.String getTypeName()
Description copied from interface:IMappingGet type name.- Specified by:
getTypeNamein interfaceIMapping- Returns:
- qualified type name, in text form (
nullif unnamed)
-
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- Throws:
JiBXException- if error in configuration
-
print
public void print(int depth)
-
-