Package org.jibx.binding.def
Class ComponentProperty
- java.lang.Object
-
- org.jibx.binding.def.PassThroughComponent
-
- org.jibx.binding.def.ComponentProperty
-
- All Implemented Interfaces:
IComponent
,ILinkable
public class ComponentProperty extends PassThroughComponent
Property reference with binding defined by component. This handles loading and storing the property value, calling the wrapped component methods for everything else.- Author:
- Dennis M. Sosnoski
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
m_forceUnmarshal
Fake content to force unmarshal to create an object.private PropertyDefinition
m_property
Property definition.private boolean
m_skipMarshal
Skip marshalling code tests flag.-
Fields inherited from class org.jibx.binding.def.PassThroughComponent
m_component
-
-
Constructor Summary
Constructors Constructor Description ComponentProperty(PropertyDefinition prop, IComponent impl, boolean skip)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
genAttributeMarshal(ContextMethodBuilder mb)
Generate attribute marshalling code.void
genAttributeUnmarshal(ContextMethodBuilder mb)
Generate attribute unmarshalling code.void
genContentMarshal(ContextMethodBuilder mb)
Generate element or text marshalling code.void
genContentUnmarshal(ContextMethodBuilder mb)
Generate element or text unmarshalling code.private void
genLoadUnmarshalInstance(ContextMethodBuilder mb)
Generate the code to load, and if necessary create, the object instance to be unmarshalled.private void
genStoreUnmarshalInstance(ContextMethodBuilder mb)
Generate the code to store the unmarshalled object instance.PropertyDefinition
getProperty()
Get the property information.boolean
hasContent()
Check if component defines one or more elements or text values as children of the containing element.boolean
isOptional()
Check if component is an optional item.void
print(int depth)
void
setForceUnmarshal(boolean force)
Set flag to force unmarshalling to create an object.void
setSkipping(boolean skip)
Set flag for skipping marshalling presence test code generation.-
Methods inherited from class org.jibx.binding.def.PassThroughComponent
genAttrPresentTest, genContentPresentTest, genLoadId, genNewInstance, getType, getWrapperName, hasAttribute, hasId, setLinkages, setWrappedComponent
-
-
-
-
Field Detail
-
m_property
private final PropertyDefinition m_property
Property definition.
-
m_skipMarshal
private boolean m_skipMarshal
Skip marshalling code tests flag.
-
m_forceUnmarshal
private boolean m_forceUnmarshal
Fake content to force unmarshal to create an object.
-
-
Constructor Detail
-
ComponentProperty
public ComponentProperty(PropertyDefinition prop, IComponent impl, boolean skip)
Constructor.- Parameters:
prop
- actual property definitionimpl
- component that defines marshalling and unmarshallingskip
- flag for marshalling code tests to be skipped
-
-
Method Detail
-
setSkipping
public void setSkipping(boolean skip)
Set flag for skipping marshalling presence test code generation.- Parameters:
skip
-true
if skipping,false
if not
-
setForceUnmarshal
public void setForceUnmarshal(boolean force)
Set flag to force unmarshalling to create an object.- Parameters:
force
-true
if skipping,false
if not
-
getProperty
public PropertyDefinition getProperty()
Get the property information. This is a kludge used by the ElementWrapper code to store anull
value directly to the property when unmarshalling a missing or xsi:nil element.- Returns:
- property information
-
genLoadUnmarshalInstance
private void genLoadUnmarshalInstance(ContextMethodBuilder mb) throws JiBXException
Generate the code to load, and if necessary create, the object instance to be unmarshalled.- Parameters:
mb
-- Throws:
JiBXException
-
genStoreUnmarshalInstance
private void genStoreUnmarshalInstance(ContextMethodBuilder mb) throws JiBXException
Generate the code to store the unmarshalled object instance.- Parameters:
mb
-- Throws:
JiBXException
-
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
-
hasContent
public boolean hasContent()
Description copied from interface:IComponent
Check if component defines one or more elements or text values as children of the containing element. This method is only valid after the call toILinkable.setLinkages()
.- Specified by:
hasContent
in interfaceIComponent
- Overrides:
hasContent
in classPassThroughComponent
- Returns:
true
if one or more content values defined for containing element,false
if not
-
genAttributeUnmarshal
public void genAttributeUnmarshal(ContextMethodBuilder mb) throws JiBXException
Description copied from interface:IComponent
Generate attribute unmarshalling code. This is called within the code generation for the unmarshaller of the class associated with the containing element. It needs to generate the necessary code for handling the unmarshalling operation, leaving the unmarshalled object reference on the stack.- Specified by:
genAttributeUnmarshal
in interfaceIComponent
- Overrides:
genAttributeUnmarshal
in classPassThroughComponent
- Parameters:
mb
- method builder- Throws:
JiBXException
- if error in configuration
-
genAttributeMarshal
public void genAttributeMarshal(ContextMethodBuilder mb) throws JiBXException
Description copied from interface:IComponent
Generate attribute marshalling code. This is called within the code generation for the marshaller of the class associated with the containing element. It needs to generate the necessary code for handling the marshalling operation, consuming the marshalled object reference from the stack.- Specified by:
genAttributeMarshal
in interfaceIComponent
- Overrides:
genAttributeMarshal
in classPassThroughComponent
- Parameters:
mb
- method builder- Throws:
JiBXException
- if error in configuration
-
genContentUnmarshal
public void genContentUnmarshal(ContextMethodBuilder mb) throws JiBXException
Description copied from interface:IComponent
Generate element or text unmarshalling code. This is called within the code generation for the unmarshaller of the class associated with the containing element. It needs to generate the necessary code for handling the unmarshalling operation, leaving the unmarshalled object reference on the stack.- Specified by:
genContentUnmarshal
in interfaceIComponent
- Overrides:
genContentUnmarshal
in classPassThroughComponent
- Parameters:
mb
- method builder- Throws:
JiBXException
- if error in configuration
-
genContentMarshal
public void genContentMarshal(ContextMethodBuilder mb) throws JiBXException
Description copied from interface:IComponent
Generate element or text marshalling code. This is called within the code generation for the marshaller of the class associated with the containing element. It needs to generate the necessary code for handling the marshalling operation, consuming the marshalled object reference from the stack.- Specified by:
genContentMarshal
in interfaceIComponent
- Overrides:
genContentMarshal
in classPassThroughComponent
- Parameters:
mb
- method builder- Throws:
JiBXException
- if error in configuration
-
print
public void print(int depth)
- Specified by:
print
in interfaceIComponent
- Overrides:
print
in classPassThroughComponent
-
-