Purpose: This mapping provides a means to keep a part of the xml tree as a collection of DOM elements.
Setting the XPath: TopLink XML mappings make use of XPath statements to find the relevant
data in an XML document. The XPath statement is relative to the context node specified in the descriptor.
The XPath may contain path and positional information; the last node in the XPath forms the local
root node for the fragment. The XPath is specified on the mapping using the setXPath
method.
| XPath | Description |
|---|---|
| phone-number | The phone-number information is stored in the phone-number element. |
| contact-info/phone-number | The XPath statement may be used to specify any valid path. |
Sample Configuration:
XMLFragmentCollectionMapping mapping = new XMLFragmentCollectionMapping();
mapping.setAttributeName("phoneNumbers");
mapping.setXPath("contact-info/phone-number");
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private boolean | |
| private boolean | |
| private AbstractNullPolicy |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | getReuseContainer()
Implements org. |
| public AbstractNullPolicy | getWrapperNullPolicy()
Implements org. |
| public String | |
| public void | initialize(AbstractSession session)
Overrides org. |
| public boolean | isAbstractCompositeDirectCollectionMapping()
Implements org. |
| public boolean | isDefaultEmptyContainer()
Implements org. |
| public boolean | isWriteOnly()
Overrides org. Implements org. |
| public boolean | |
| public void | preInitialize(AbstractSession session)
Overrides org. |
| public void | setAttributeValueInObject(Object
TODO object, Object TODO value)Overrides org. Implements org. |
| public void | setDefaultEmptyContainer(boolean defaultEmptyContainer)
Implements org. |
| public void | |
| public void | setReuseContainer(boolean reuseContainer)
Implements org. |
| public void | setWrapperNullPolicy(AbstractNullPolicy policy)
Implements org. |
| public void | |
| public Object | valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed)
Overrides org. |
| public void | writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session, DatabaseMapping.
|
| public void | writeSingleValue(Object
- The value to be marshalled attributeValue, Object parent, XMLRecord - The Record the value is being marshalled too. row, AbstractSession session)Implements org. |
| defaultEmptyContainer | back to summary |
|---|---|
| private boolean defaultEmptyContainer | |
| isWriteOnly | back to summary |
|---|---|
| private boolean isWriteOnly | |
| reuseContainer | back to summary |
|---|---|
| private boolean reuseContainer | |
| wrapperNullPolicy | back to summary |
|---|---|
| private AbstractNullPolicy wrapperNullPolicy | |
| XMLFragmentCollectionMapping | back to summary |
|---|---|
| public XMLFragmentCollectionMapping() | |
| getReuseContainer | back to summary |
|---|---|
| public boolean getReuseContainer() Implements org. Return true if the original container on the object should be used if present. If it is not present then the container policy will be used to create the container.
| |
| getWrapperNullPolicy | back to summary |
|---|---|
| public AbstractNullPolicy getWrapperNullPolicy() Implements org. Doc from org. Get the Wrapper NullPolicy from the Mapping.
| |
| getXPath | back to summary |
|---|---|
| public String getXPath() Get the XPath String
| |
| initialize | back to summary |
|---|---|
| public void initialize(AbstractSession session) throws DescriptorException Overrides org. INTERNAL: Initialize the mapping.
| |
| isAbstractCompositeDirectCollectionMapping | back to summary |
|---|---|
| public boolean isAbstractCompositeDirectCollectionMapping() Implements org. Doc from org. Related mapping should implement this method to return true.
| |
| isDefaultEmptyContainer | back to summary |
|---|---|
| public boolean isDefaultEmptyContainer() Implements org. INTERNAL Return true if an empty container should be set on the object if there is no presence of the collection in the XML document.
| |
| isWriteOnly | back to summary |
|---|---|
| public boolean isWriteOnly() Overrides org. Implements org. Doc from org. INTERNAL: Some mappings support no attribute (transformation and multitenant primary key).
| |
| isXMLMapping | back to summary |
|---|---|
| public boolean isXMLMapping() Overrides org. INTERNAL:
| |
| preInitialize | back to summary |
|---|---|
| public void preInitialize(AbstractSession session) throws DescriptorException Overrides org. Doc from org. INTERNAL: Allow for initialization of properties and validation.
| |
| setAttributeValueInObject | back to summary |
|---|---|
| public void setAttributeValueInObject(Object object, Object value) throws DescriptorException Overrides org. Implements org. Doc from org. INTERNAL: Set the value of the attribute mapped by this mapping.
| |
| setDefaultEmptyContainer | back to summary |
|---|---|
| public void setDefaultEmptyContainer(boolean defaultEmptyContainer) Implements org. INTERNAL Indicate whether by default an empty container should be set on the field/property if the collection is not present in the XML document.
| |
| setIsWriteOnly | back to summary |
|---|---|
| public void setIsWriteOnly(boolean b) Implements org.
| |
| setReuseContainer | back to summary |
|---|---|
| public void setReuseContainer(boolean reuseContainer) Implements org. Specify whether the original container on the object should be used if present. If it is not present then the container policy will be used to create the container.
| |
| setWrapperNullPolicy | back to summary |
|---|---|
| public void setWrapperNullPolicy(AbstractNullPolicy policy) Implements org. Doc from org. Set the Wrapper NullPolicy on the Mapping.
| |
| setXPath | back to summary |
|---|---|
| public void setXPath(String xpathString) Set the Mapping field name attribute to the given XPath String
| |
| valueFromRow | back to summary |
|---|---|
| public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) throws DatabaseException Overrides org. INTERNAL: Build the nested collection from the database row.
| |
| writeFromObjectIntoRow | back to summary |
|---|---|
| public void writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session, DatabaseMapping. INTERNAL:
| |
| writeSingleValue | back to summary |
|---|---|
| public void writeSingleValue(Object attributeValue, Object parent, XMLRecord row, AbstractSession session) Implements org. Doc from org. INTERNAL: A method that marshals a single value to the provided Record based on this mapping's XPath. Used for Sequenced marshalling. | |