Package org.jibx.binding.def
Class PrecompiledAbstractMapping
java.lang.Object
org.jibx.binding.def.PrecompiledAbstractMapping
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
FieldsModifier and TypeFieldDescriptionprivate final PrecompiledBinding
Binding structure defining the mapping.private final ClassFile
Class linked to mapping.private final String
Name used for mapping in binding tables.private final ArrayList
Namespaces used by this mapping.private final IContainer
Containing context for definition.private final String
Reference type of mapping, as fully qualified class name.private final boolean
Namespace index translation required flag.private final String
Qualified type name. -
Constructor Summary
ConstructorsConstructorDescriptionPrecompiledAbstractMapping
(String type, String tname, String mapname, int index, IBindingFactory factory, int[] nsxlate, IContainer parent) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add extension to abstract mapping.void
Add namespace.buildRef
(IContainer parent, IContextObj objc, String type, PropertyDefinition prop) Build reference to mapping.void
generateCode
(boolean force) Generate required code for mapping.Get the actual binding for a mapping.Get class name handled by mapping.Get binding component implementing mapping.Get the mapping name used in binding tables.Get marshaller class used for mapping.getName()
Get mapped element name.Get namespaces defined for mapping.Get class name of type to be assumed for references to this mapping.Get type name.Get unmarshaller class used for mapping.boolean
Check if mapping is abstract.boolean
isBase()
Check if mapping has extensions.void
Links extension mappings to their base mappings.void
print
(int depth) void
Establish and validate linkages between binding components.
-
Field Details
-
m_translated
private final boolean m_translatedNamespace index translation required flag. -
m_class
Class linked to mapping. -
m_typeName
Qualified type name. -
m_binding
Binding structure defining the mapping. -
m_referenceType
Reference type of mapping, as fully qualified class name. -
m_namespaces
Namespaces used by this mapping. -
m_parent
Containing context for definition. -
m_mappingName
Name used for mapping in binding tables.
-
-
Constructor Details
-
PrecompiledAbstractMapping
public PrecompiledAbstractMapping(String type, String tname, String mapname, int index, IBindingFactory factory, int[] nsxlate, IContainer parent) throws JiBXException Constructor.- Parameters:
type
- bound class nametname
- qualified type name for abstract mapping (null
if none)mapname
- abstract mapping name in bindingindex
- abstract mapping index in bindingfactory
- binding factory for mapping informationnsxlate
- namespace index translation table (null
if none)parent
- containing context- Throws:
JiBXException
- if class definition not found
-
-
Method Details
-
linkMappings
Links extension mappings to their base mappings. For precompiled mappings this does nothing.- Throws:
JiBXException
- if error in linking
-
getBoundType
Description copied from interface:IMapping
Get class name handled by mapping.- Specified by:
getBoundType
in interfaceIMapping
- Returns:
- name of class bound by mapping
-
getReferenceType
Description copied from interface:IMapping
Get class name of type to be assumed for references to this mapping.- Specified by:
getReferenceType
in interfaceIMapping
- Returns:
- reference type class name name
-
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 interfaceIMapping
- Returns:
- binding component implementing this mapping
-
getMarshaller
Description copied from interface:IMapping
Get marshaller class used for mapping.- Specified by:
getMarshaller
in interfaceIMapping
- Returns:
- marshaller class information
-
getUnmarshaller
Description copied from interface:IMapping
Get unmarshaller class used for mapping.- Specified by:
getUnmarshaller
in interfaceIMapping
- Returns:
- unmarshaller class information
-
getName
Description copied from interface:IMapping
Get mapped element name. -
addNamespace
Description copied from interface:IMapping
Add namespace. This adds a namespace definition to those active for the mapping.- Specified by:
addNamespace
in interfaceIMapping
- 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 interfaceIMapping
- Returns:
true
if an abstract mapping,false
if not
-
isBase
public boolean isBase()Description copied from interface:IMapping
Check if mapping has extensions. -
addExtension
Description copied from interface:IMapping
Add extension to abstract mapping. This call is only valid for abstract mappings.- Specified by:
addExtension
in interfaceIMapping
- Parameters:
mdef
- extension mapping definition- Throws:
JiBXException
- if configuration error
-
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.- Specified by:
buildRef
in 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
Description copied from interface:IMapping
Get namespaces defined for mapping.- Specified by:
getNamespaces
in interfaceIMapping
- Returns:
- namespace definitions (may be
null
if none)
-
generateCode
Description copied from interface:IMapping
Generate required code for mapping.- Specified by:
generateCode
in 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
-
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 interfaceIMapping
- Returns:
- binding structure, or
null
if none
-
getMappingName
Description copied from interface:IMapping
Get the mapping name used in binding tables.- Specified by:
getMappingName
in interfaceIMapping
- Returns:
- name
-
getTypeName
Description copied from interface:IMapping
Get type name.- Specified by:
getTypeName
in interfaceIMapping
- Returns:
- qualified type name, in text form (
null
if unnamed)
-
setLinkages
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 interfaceILinkable
- Throws:
JiBXException
- if error in configuration
-
print
public void print(int depth)
-