public class ObjectBinding extends PassThroughComponent implements IComponent, IContextObj
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ATTR_PRESENCE_SUFFIX |
private static java.lang.String |
COMPLETE_SUFFIX |
private static Type[] |
EMPTY_ARGS |
private static java.lang.String[] |
FACTORY_HOOK_SIGNATURES |
private static java.lang.String |
GETSTACKTOP_SIGNATURE |
private ClassItem |
m_attributePresenceMethod
Generated attribute presence test method.
|
private java.lang.String |
m_attributePresenceName
Name for attribute presence test method (
null unless
generation started). |
private boolean |
m_checkedComplete
Checked for complete method needed flag.
|
private boolean |
m_checkedPrepare
Checked for prepare method needed flag.
|
private BoundClass |
m_class
Class linked to mapping.
|
private java.lang.String |
m_completeName
Complete method name (
null if none, or not yet checked). |
private IContainer |
m_container
Containing binding definition structure.
|
private ClassItem |
m_contentPresenceMethod
Generated content presence test method.
|
private java.lang.String |
m_contentPresenceName
Name for content presence test method (
null unless
generation started). |
private ClassFile |
m_createClass
Type to be used for creating new instances.
|
private java.lang.String |
m_createName
Create method fully-qualified name (
null if not yet
generated). |
private ClassItem |
m_factoryMethod
Object factory method.
|
private boolean |
m_fakeContent
Fake content present flag, used when neither content nor attributes
are present.
|
private IComponent |
m_idChild
Child supplying instance identifier value.
|
private boolean |
m_lockAttributeMarshal
Flag for recursion while generating attribute marshal.
|
private boolean |
m_lockAttributePresence
Flag for recursion while generating attribute presence test.
|
private boolean |
m_lockAttributeUnmarshal
Flag for recursion while generating attribute unmarshal.
|
private boolean |
m_lockContentMarshal
Flag for recursion while generating attribute marshal.
|
private boolean |
m_lockContentPresence
Flag for recursion while generating content presence test.
|
private boolean |
m_lockContentUnmarshal
Flag for recursion while generating attribute unmarshal.
|
private boolean |
m_mappingWrapper
Flag for dummy object binding, used when a concrete mapping just adds a
name around an abstract mapping.
|
private ClassItem |
m_marshalAttributeMethod
Generated marshal attribute method.
|
private java.lang.String |
m_marshalAttributeName
Name for marshal attribute method (
null unless
generation started). |
private ClassItem |
m_marshalContentMethod
Generated marshal content method.
|
private java.lang.String |
m_marshalContentName
Name for marshal content method (
null unless
generation started). |
private java.lang.String |
m_marshalSignature
Signature used for marshal methods.
|
private ClassItem |
m_newInstanceMethod
Generated new instance method.
|
private ClassItem |
m_postSetMethod
Postset method for object.
|
private ClassItem |
m_preGetMethod
Preget method for object.
|
private java.lang.String |
m_prepareName
Prepare method name (
null if none, or not yet checked). |
private ClassItem |
m_preSetMethod
Preset method for object.
|
private ClassItem |
m_unmarshalAttributeMethod
Generated unmarshal attribute method.
|
private java.lang.String |
m_unmarshalAttributeName
Name for unmarshal attribute method (
null unless
generation started). |
private ClassItem |
m_unmarshalContentMethod
Generated unmarshal content method.
|
private java.lang.String |
m_unmarshalContentName
Name for unmarshal content method (
null unless
generation started). |
private java.lang.String |
m_unmarshalSignature
Signature used for unmarshal methods.
|
private static java.lang.String |
MARSHAL_ATTR_SUFFIX |
private static java.lang.String |
MARSHAL_GETSTACKTOPMETHOD |
private static java.lang.String[] |
MARSHAL_HOOK_SIGNATURES |
private static java.lang.String |
MARSHAL_PARAMETER_NORET_SIGNATURE |
private static java.lang.String |
MARSHAL_POPOBJECTMETHOD |
private static java.lang.String |
MARSHAL_PUSHOBJECTMETHOD |
private static java.lang.String |
MARSHAL_SUFFIX |
private static Type |
MARSHALCONTEXT_TYPE |
private static java.lang.String |
MARSHALLING_CONTEXT |
private static java.lang.String |
NEWINSTANCE_SUFFIX |
private static java.lang.String |
POPOBJECT_SIGNATURE |
private static java.lang.String |
PREPARE_SUFFIX |
private static java.lang.String |
PRESENCE_SUFFIX |
private static java.lang.String |
PUSHOBJECT_SIGNATURE |
private static Type[] |
SETSOURCE_ARGS |
private static java.lang.String |
SETSOURCE_METHODNAME |
private static java.lang.String |
SOURCE_TRACKING_INTERFACE |
private static java.lang.String |
SOURCECOLUMN_FIELDNAME |
private static java.lang.String |
SOURCECOLUMN_METHODNAME |
private static java.lang.String |
SOURCEDOCUMENT_FIELDNAME |
private static java.lang.String |
SOURCELINE_FIELDNAME |
private static java.lang.String |
SOURCELINE_METHODNAME |
private static java.lang.String |
SOURCENAME_METHODNAME |
private static java.lang.String |
UNMARSHAL_ATTR_SUFFIX |
private static java.lang.String |
UNMARSHAL_GETSTACKTOPMETHOD |
private static java.lang.String[] |
UNMARSHAL_HOOK_SIGNATURES |
private static java.lang.String |
UNMARSHAL_PARAMETER_NORET_SIGNATURE |
private static java.lang.String |
UNMARSHAL_PARAMETER_SIGNATURE |
private static java.lang.String |
UNMARSHAL_POPOBJECTMETHOD |
private static java.lang.String |
UNMARSHAL_PUSHOBJECTMETHOD |
private static java.lang.String |
UNMARSHAL_PUSHTRACKEDOBJECTMETHOD |
private static java.lang.String |
UNMARSHAL_SUFFIX |
private static Type[] |
UNMARSHALCONTEXT_ARGS |
private static Type |
UNMARSHALCONTEXT_TYPE |
private static java.lang.String |
UNMARSHALLING_CONTEXT |
m_component
Constructor and Description |
---|
ObjectBinding(IContainer contain,
IContextObj objc,
java.lang.String type,
java.lang.String fact,
java.lang.String pres,
java.lang.String posts,
java.lang.String pget,
java.lang.String ctype)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
genAttributeMarshal(ContextMethodBuilder mb)
Generate attribute marshalling code.
|
private void |
genAttributePresenceMethod()
Generate attribute presence test method for object.
|
void |
genAttributeUnmarshal(ContextMethodBuilder mb)
Generate attribute unmarshalling code.
|
void |
genAttrPresentTest(ContextMethodBuilder mb)
Generate code to test for attribute present.
|
private void |
genCompleteMethod()
Generate unmarshalling complete method for object, if needed.
|
void |
genContentMarshal(ContextMethodBuilder mb)
Generate element or text marshalling code.
|
private void |
genContentPresenceMethod()
Generate content presence test method for object.
|
void |
genContentPresentTest(ContextMethodBuilder mb)
Generate code to test for content present.
|
void |
genContentUnmarshal(ContextMethodBuilder mb)
Generate element or text unmarshalling code.
|
private void |
genCreateMethod()
Generate create method for object.
|
void |
genLoadId(ContextMethodBuilder mb)
Generate code to load ID value of instance to stack.
|
private void |
genMarshalAttributeMethod()
Generate attribute marshal method for object.
|
private void |
genMarshalContentMethod()
Generate content marshal method for object.
|
void |
genNewInstance(ContextMethodBuilder mb)
Generate code to create new instance of object.
|
private void |
genPrepareMethod()
Generate prepare for marshalling method for object, if needed.
|
private void |
genTrackSourceCode()
Generate code to handle unmarshal source location tracking.
|
private void |
genUnmarshalAttributeMethod()
Generate attribute unmarshal method for object.
|
private void |
genUnmarshalContentMethod()
Generate content unmarshal method for object.
|
private void |
genUserMethodCall(boolean in,
ClassItem method,
ContextMethodBuilder mb)
Generate code for calling a user supplied method.
|
java.lang.String |
getAttributeMarshalMethod()
Get the method which marshals attributes from an instance.
|
java.lang.String |
getAttributePresentTestMethod()
Get the method which checks attributes to determine if an instance is
present.
|
java.lang.String |
getAttributeUnmarshalMethod()
Get the method which unmarshals attributes into an instance.
|
BoundClass |
getBoundClass()
Get class linked to binding element.
|
java.lang.String |
getCompleteMethod()
Get the method which handles unmarshalling completion.
|
java.lang.String |
getContentMarshalMethod()
Get the method which marshals child elements and character data content
from an instance.
|
java.lang.String |
getContentPresentTestMethod()
Get the method which checks child elements to determine if an instance is
present.
|
java.lang.String |
getContentUnmarshalMethod()
Get the method which unmarshals child elements and character data content
into an instance.
|
java.lang.String |
getCreateMethod()
Get the method which creates an instance of the bound class if one does
not already exist.
|
java.lang.String |
getPrepareMethod()
Get the method which handles preparation for marshalling an instance.
|
java.lang.String |
getType()
Get type expected by component.
|
boolean |
hasContent()
Check if component defines one or more elements or text values as
children of the containing element.
|
boolean |
hasId()
Check if component defines an ID value for instances of context object.
|
boolean |
isOptional()
Check if component is an optional item.
|
void |
print(int depth) |
boolean |
setIdChild(IComponent child)
Set ID property.
|
void |
setLinkages()
Establish and validate linkages between binding components.
|
getWrapperName, hasAttribute, setWrappedComponent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getWrapperName, hasAttribute
private static final java.lang.String[] MARSHAL_HOOK_SIGNATURES
private static final java.lang.String[] FACTORY_HOOK_SIGNATURES
private static final java.lang.String[] UNMARSHAL_HOOK_SIGNATURES
private static final java.lang.String UNMARSHAL_GETSTACKTOPMETHOD
private static final java.lang.String MARSHAL_GETSTACKTOPMETHOD
private static final java.lang.String GETSTACKTOP_SIGNATURE
private static final java.lang.String MARSHALLING_CONTEXT
private static final java.lang.String UNMARSHALLING_CONTEXT
private static final java.lang.String UNMARSHAL_PARAMETER_SIGNATURE
private static final java.lang.String UNMARSHAL_PUSHOBJECTMETHOD
private static final java.lang.String UNMARSHAL_PUSHTRACKEDOBJECTMETHOD
private static final java.lang.String MARSHAL_PUSHOBJECTMETHOD
private static final java.lang.String PUSHOBJECT_SIGNATURE
private static final java.lang.String UNMARSHAL_POPOBJECTMETHOD
private static final java.lang.String MARSHAL_POPOBJECTMETHOD
private static final java.lang.String POPOBJECT_SIGNATURE
private static final java.lang.String UNMARSHAL_PARAMETER_NORET_SIGNATURE
private static final java.lang.String MARSHAL_PARAMETER_NORET_SIGNATURE
private static final java.lang.String NEWINSTANCE_SUFFIX
private static final java.lang.String PREPARE_SUFFIX
private static final java.lang.String COMPLETE_SUFFIX
private static final java.lang.String ATTR_PRESENCE_SUFFIX
private static final java.lang.String UNMARSHAL_ATTR_SUFFIX
private static final java.lang.String MARSHAL_ATTR_SUFFIX
private static final java.lang.String PRESENCE_SUFFIX
private static final java.lang.String UNMARSHAL_SUFFIX
private static final java.lang.String MARSHAL_SUFFIX
private static final Type UNMARSHALCONTEXT_TYPE
private static final Type[] UNMARSHALCONTEXT_ARGS
private static final Type MARSHALCONTEXT_TYPE
private static final java.lang.String SOURCE_TRACKING_INTERFACE
private static final java.lang.String SETSOURCE_METHODNAME
private static final Type[] SETSOURCE_ARGS
private static final java.lang.String SOURCEDOCUMENT_FIELDNAME
private static final java.lang.String SOURCELINE_FIELDNAME
private static final java.lang.String SOURCECOLUMN_FIELDNAME
private static final java.lang.String SOURCENAME_METHODNAME
private static final java.lang.String SOURCELINE_METHODNAME
private static final java.lang.String SOURCECOLUMN_METHODNAME
private static final Type[] EMPTY_ARGS
private final IContainer m_container
private BoundClass m_class
private final ClassItem m_factoryMethod
private final ClassItem m_preSetMethod
private final ClassItem m_postSetMethod
private final ClassItem m_preGetMethod
private final ClassFile m_createClass
private java.lang.String m_createName
null
if not yet
generated).private boolean m_checkedComplete
private boolean m_checkedPrepare
private java.lang.String m_completeName
null
if none, or not yet checked).private java.lang.String m_prepareName
null
if none, or not yet checked).private ClassItem m_newInstanceMethod
private boolean m_lockAttributePresence
private boolean m_lockContentPresence
private boolean m_lockAttributeUnmarshal
private boolean m_lockAttributeMarshal
private boolean m_lockContentUnmarshal
private boolean m_lockContentMarshal
private java.lang.String m_attributePresenceName
null
unless
generation started).private java.lang.String m_contentPresenceName
null
unless
generation started).private java.lang.String m_unmarshalSignature
private java.lang.String m_unmarshalAttributeName
null
unless
generation started).private java.lang.String m_unmarshalContentName
null
unless
generation started).private java.lang.String m_marshalSignature
private java.lang.String m_marshalAttributeName
null
unless
generation started).private java.lang.String m_marshalContentName
null
unless
generation started).private ClassItem m_attributePresenceMethod
private ClassItem m_contentPresenceMethod
private ClassItem m_unmarshalAttributeMethod
private ClassItem m_unmarshalContentMethod
private ClassItem m_marshalAttributeMethod
private ClassItem m_marshalContentMethod
private IComponent m_idChild
private boolean m_fakeContent
private boolean m_mappingWrapper
public ObjectBinding(IContainer contain, IContextObj objc, java.lang.String type, java.lang.String fact, java.lang.String pres, java.lang.String posts, java.lang.String pget, java.lang.String ctype) throws JiBXException
contain
- containing binding definition componentobjc
- current object contexttype
- fully qualified class name for bound objectfact
- user new instance factory methodpres
- user preset method for unmarshallingposts
- user postset method for unmarshallingpget
- user preget method for marshallingctype
- type to use for creating new instance (null
if
not specified)JiBXException
- if method not foundprivate void genUserMethodCall(boolean in, ClassItem method, ContextMethodBuilder mb)
in
- flag for unmarshalling methodmethod
- information for method being calledmb
- method builder for generated codeprivate void genCreateMethod() throws JiBXException
ITypeBinding.getCreateMethod()
result signature.JiBXException
- if error in generating codeprivate void genPrepareMethod() throws JiBXException
ITypeBinding.getPrepareMethod()
result signature.JiBXException
- if error in generating codeprivate void genCompleteMethod() throws JiBXException
ITypeBinding.getCompleteMethod()
result signature.JiBXException
- if error in generating codeprivate void genTrackSourceCode()
private void genAttributePresenceMethod() throws JiBXException
ITypeBinding.getAttributePresentTestMethod()
result
signature.JiBXException
- if error in configurationprivate void genUnmarshalAttributeMethod() throws JiBXException
ITypeBinding.getAttributeUnmarshalMethod()
result
signature.JiBXException
- if error in configurationprivate void genMarshalAttributeMethod() throws JiBXException
ITypeBinding.getAttributeMarshalMethod()
result
signature.JiBXException
- if error in configurationprivate void genContentPresenceMethod() throws JiBXException
ITypeBinding.getContentPresentTestMethod()
result
signature.JiBXException
- if error in configurationprivate void genUnmarshalContentMethod() throws JiBXException
ITypeBinding.getContentUnmarshalMethod()
result
signature.JiBXException
private void genMarshalContentMethod() throws JiBXException
ITypeBinding.getContentMarshalMethod()
result
signature.JiBXException
public BoundClass getBoundClass()
IContextObj
getBoundClass
in interface IContextObj
public boolean setIdChild(IComponent child)
IContextObj
setIdChild
in interface IContextObj
child
- child defining the ID propertytrue
if successful, false
if ID
already definedpublic boolean isOptional()
IComponent
isOptional
in interface IComponent
isOptional
in class PassThroughComponent
true
if optional, false
if requiredpublic boolean hasContent()
IComponent
ILinkable.setLinkages()
.hasContent
in interface IComponent
hasContent
in class PassThroughComponent
true
if one or more content values defined
for containing element, false
if notpublic void genAttrPresentTest(ContextMethodBuilder mb) throws JiBXException
IComponent
genAttrPresentTest
in interface IComponent
genAttrPresentTest
in class PassThroughComponent
mb
- method builderJiBXException
- if configuration errorpublic void genContentPresentTest(ContextMethodBuilder mb) throws JiBXException
IComponent
genContentPresentTest
in interface IComponent
genContentPresentTest
in class PassThroughComponent
mb
- method builderJiBXException
- if configuration errorpublic void genAttributeUnmarshal(ContextMethodBuilder mb) throws JiBXException
IComponent
genAttributeUnmarshal
in interface IComponent
genAttributeUnmarshal
in class PassThroughComponent
mb
- method builderJiBXException
- if error in configurationpublic void genAttributeMarshal(ContextMethodBuilder mb) throws JiBXException
IComponent
genAttributeMarshal
in interface IComponent
genAttributeMarshal
in class PassThroughComponent
mb
- method builderJiBXException
- if error in configurationpublic void genContentUnmarshal(ContextMethodBuilder mb) throws JiBXException
IComponent
genContentUnmarshal
in interface IComponent
genContentUnmarshal
in class PassThroughComponent
mb
- method builderJiBXException
- if error in configurationpublic void genContentMarshal(ContextMethodBuilder mb) throws JiBXException
IComponent
genContentMarshal
in interface IComponent
genContentMarshal
in class PassThroughComponent
mb
- method builderJiBXException
- if error in configurationpublic void genNewInstance(ContextMethodBuilder mb) throws JiBXException
IComponent
genNewInstance
in interface IComponent
genNewInstance
in class PassThroughComponent
mb
- method builderJiBXException
- if error in configurationpublic java.lang.String getType()
IComponent
getType
in interface IComponent
getType
in class PassThroughComponent
public boolean hasId()
IComponent
hasId
in interface IComponent
hasId
in class PassThroughComponent
true
if ID value defined for instances,
false
if notpublic void genLoadId(ContextMethodBuilder mb) throws JiBXException
IComponent
String
).genLoadId
in interface IComponent
genLoadId
in class PassThroughComponent
mb
- method builderJiBXException
- if configuration errorpublic void setLinkages() throws JiBXException
ILinkable
setLinkages
in interface ILinkable
setLinkages
in class PassThroughComponent
JiBXException
- if error in configurationpublic java.lang.String getAttributeMarshalMethod() throws JiBXException
ITypeBinding
getAttributeMarshalMethod
in interface ITypeBinding
null
if noneJiBXException
- on error in code generationpublic java.lang.String getAttributePresentTestMethod() throws JiBXException
ITypeBinding
true
if an attribute of the mapping
is found, false
if not.getAttributePresentTestMethod
in interface ITypeBinding
null
if noneJiBXException
- on error in code generationpublic java.lang.String getAttributeUnmarshalMethod() throws JiBXException
ITypeBinding
getAttributeUnmarshalMethod
in interface ITypeBinding
null
if noneJiBXException
- on error in code generationpublic java.lang.String getCompleteMethod() throws JiBXException
ITypeBinding
getCompleteMethod
in interface ITypeBinding
null
if noneJiBXException
- on error in code generationpublic java.lang.String getContentMarshalMethod() throws JiBXException
ITypeBinding
getContentMarshalMethod
in interface ITypeBinding
null
if noneJiBXException
- on error in code generationpublic java.lang.String getContentPresentTestMethod() throws JiBXException
ITypeBinding
true
if an attribute of the mapping
is found, false
if not.getContentPresentTestMethod
in interface ITypeBinding
null
if noneJiBXException
- on error in code generationpublic java.lang.String getContentUnmarshalMethod() throws JiBXException
ITypeBinding
getContentUnmarshalMethod
in interface ITypeBinding
null
if noneJiBXException
- on error in code generationpublic java.lang.String getCreateMethod() throws JiBXException
ITypeBinding
null
that reference will
simply be returned; otherwise, a new instance will be created and
returned. This method also handles any appropriate pre-set processing for
the instance.getCreateMethod
in interface ITypeBinding
null
if noneJiBXException
- on error in code generationpublic java.lang.String getPrepareMethod() throws JiBXException
ITypeBinding
getPrepareMethod
in interface ITypeBinding
null
if noneJiBXException
- on error in code generationpublic void print(int depth)
print
in interface IComponent
print
in class PassThroughComponent