Package org.jibx.binding.def
Class MappingReference
- java.lang.Object
-
- org.jibx.binding.def.PassThroughComponent
-
- org.jibx.binding.def.MappingReference
-
- All Implemented Interfaces:
IComponent
,ILinkable
public class MappingReference extends PassThroughComponent
Reference to a mapping definition. This is used as a placeholder when building the component structure of a binding definition. It's necessary because the referenced mapping may not have been parsed yet. During the linkage phase that follows parsing this looks up the appropriate mapping definition and sets up the corresponding component structure. Thereafter it operates as a simple pass-through wrapper for the top child component.- Author:
- Dennis M. Sosnoski
-
-
Field Summary
Fields Modifier and Type Field Description private IContainer
m_container
Containing binding definition structure.private IContextObj
m_contextObject
Context object.private boolean
m_isNillable
Flag for nillable element.private boolean
m_isSynthetic
Synthetic reference added to empty collection flagprivate IMapping
m_mapping
Referenced mapping.private NameDefinition
m_name
Name from reference (only allowed with abstract mappings)private PropertyDefinition
m_property
Property definition.private java.lang.String
m_referenceQName
Qualified name of type for abstract mapping.private java.lang.String
m_referenceText
Ordinary name of type for abstract mapping.private java.lang.String
m_type
Fully qualified name of mapped type.private IComponent
m_wrappedReference
Generated wrapped component, used when checking for both attributes and elements present.-
Fields inherited from class org.jibx.binding.def.PassThroughComponent
m_component
-
-
Constructor Summary
Constructors Constructor Description MappingReference(IContainer contain, PropertyDefinition prop, java.lang.String type, java.lang.String reftext, java.lang.String refqname, IContextObj objc, NameDefinition name, boolean synth, boolean nillable)
Constructor from property and type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
genContentUnmarshal(ContextMethodBuilder mb)
Patch the generated code to remove the unmarshalled object when it's a "this" reference with both elements and attributes.IMapping
getMapping()
java.lang.String
getType()
Get type expected by component.boolean
isOptional()
Check if component is an optional item.void
print(int depth)
void
setLinkages()
Establish and validate linkages between binding components.-
Methods inherited from class org.jibx.binding.def.PassThroughComponent
genAttributeMarshal, genAttributeUnmarshal, genAttrPresentTest, genContentMarshal, genContentPresentTest, genLoadId, genNewInstance, getWrapperName, hasAttribute, hasContent, hasId, setWrappedComponent
-
-
-
-
Field Detail
-
m_container
private final IContainer m_container
Containing binding definition structure.
-
m_property
private final PropertyDefinition m_property
Property definition.
-
m_isNillable
private final boolean m_isNillable
Flag for nillable element.
-
m_type
private java.lang.String m_type
Fully qualified name of mapped type.
-
m_referenceText
private java.lang.String m_referenceText
Ordinary name of type for abstract mapping.
-
m_referenceQName
private java.lang.String m_referenceQName
Qualified name of type for abstract mapping.
-
m_contextObject
private final IContextObj m_contextObject
Context object.
-
m_name
private final NameDefinition m_name
Name from reference (only allowed with abstract mappings)
-
m_isSynthetic
private final boolean m_isSynthetic
Synthetic reference added to empty collection flag
-
m_mapping
private IMapping m_mapping
Referenced mapping.
-
m_wrappedReference
private IComponent m_wrappedReference
Generated wrapped component, used when checking for both attributes and elements present.
-
-
Constructor Detail
-
MappingReference
public MappingReference(IContainer contain, PropertyDefinition prop, java.lang.String type, java.lang.String reftext, java.lang.String refqname, IContextObj objc, NameDefinition name, boolean synth, boolean nillable)
Constructor from property and type.- Parameters:
contain
- containing binding definition structureprop
- property definitiontype
- fully qualified name of mapped typereftext
- ordinary text name for abstract mapping reference (null
if not specified)refqname
- qualified type name for abstract mapping reference (null
if not specified)objc
- current object contextname
- reference name definition (only allowed with abstract mappings)synth
- sythentic reference added to empty collection flagnillable
- flag for nillable element
-
-
Method Detail
-
getMapping
public IMapping getMapping()
-
isOptional
public boolean isOptional()
Description copied from interface:IComponent
Check if component is an optional item.- Specified by:
isOptional
in interfaceIComponent
- Overrides:
isOptional
in classPassThroughComponent
- Returns:
true
if optional,false
if required
-
getType
public java.lang.String getType()
Description copied from interface:IComponent
Get type expected by component.- Specified by:
getType
in interfaceIComponent
- Overrides:
getType
in classPassThroughComponent
- Returns:
- fully qualified class name of expected type
-
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 interfaceILinkable
- Overrides:
setLinkages
in classPassThroughComponent
- Throws:
JiBXException
- if error in configuration
-
genContentUnmarshal
public void genContentUnmarshal(ContextMethodBuilder mb) throws JiBXException
Patch the generated code to remove the unmarshalled object when it's a "this" reference with both elements and attributes.- Specified by:
genContentUnmarshal
in interfaceIComponent
- Overrides:
genContentUnmarshal
in classPassThroughComponent
- Parameters:
mb
-- Throws:
JiBXException
-
print
public void print(int depth)
- Specified by:
print
in interfaceIComponent
- Overrides:
print
in classPassThroughComponent
-
-