| 
 | EclipseLink1.0 - 20080707 API Reference | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.persistence.oxm.mappings.nullpolicy.AbstractNullPolicy
org.eclipse.persistence.oxm.mappings.nullpolicy.NullPolicy
public class NullPolicy
PUBLIC:
 Description: 
 This null policy is the default implementation class.
 Marshal:
 The boolean value of the isSet() state of a node has no effect on whether a node will be written out
 for a null value - a set is always performed unless the isSetPerformedForAbsentNode flag
 is set to false for absent nodes.
 Unmarshal:
  
 
The following instance field can be set on top of the two from AbstractNullPolicy:
 Usage:
 
Unmarshal null direct element xsi:nil node:
Code Sample
 
 XMLDescriptor aDescriptor = new XMLDescriptor();
 
 aDescriptor.setJavaClass(Employee.class);
 aDescriptor.setDefaultRootElement("employee");
 XMLDirectMapping firstNameMapping = new XMLDirectMapping();
 firstNameMapping.setAttributeName("firstname");
 firstNameMapping.setXPath("first-name/text()");
 AbstractNullPolicy aNullPolicy = new NullPolicy();
 aDescriptor.addMapping(firstNameMapping);
 aNullPolicy.setSetPerformedForAbsentNode(false); // no effect
 aNullPolicy.setNullRepresentedByEmptyNodeNode(false); // default or no effect
 aNullPolicy.setNullRepresentedByXsiNil(false); // default or no effect
 
Input XML
 
 <employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
   <firstname xsi:nil=true/>
 </employee>
 
Output Object State
 
 anEmployee.getFirstname() = null
 
 anEmployee.isSet(firstname) = true
 
Marshal null composite object (isSet=true) as empty node: .
Code Sample
 
 XMLDescriptor aDescriptor = new XMLDescriptor();
 
 
 aDescriptor.setJavaClass(Team.class);
 aDescriptor.setDefaultRootElement("team");
 XMLCompositeObjectMapping aManagerMapping = new XMLCompositeObjectMapping();
 aManagerMapping.setAttributeName("manager");
 aManagerMapping.setXPath("manager/text()");
 // do not modify the default NullPolicy or the 3 boolean flags
 AbstractNullPolicy aNullPolicy = afirstNameMapping.getNullPolicy();
 aDescriptor.addMapping(aManagerMapping);
 aNullPolicy.setMarshalNullRepresentation(XMLNullRepresentationType.EMPTY_NODE);
 
Input Object State
 
 aTeam.getManager() = null
 
 aTeam.isSet(manager) = no effect
 
Output XML
 
 <team xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <manager/>
 </team>
 
NullCapableValue| Field Summary | 
|---|
| Fields inherited from class org.eclipse.persistence.oxm.mappings.nullpolicy.AbstractNullPolicy | 
|---|
| COLON_W_SCHEMA_NIL_ATTRIBUTE, EMPTY_STRING, isNullRepresentedByEmptyNode, isNullRepresentedByXsiNil, isSetPerformedForAbsentNode, marshalNullRepresentation, TRUE, XSI_NIL_ATTRIBUTE | 
| Constructor Summary | |
|---|---|
| NullPolicy()Default Constructor | |
| NullPolicy(java.lang.String anIsSetMethodName,
           boolean bIsSetPerformedForAbsentNode,
           boolean bIsNullRepresentedByEmptyNode,
           boolean bIsNullRepresentedByXsiNil)Specific Constructor to set the Unmarshal flags | |
| NullPolicy(java.lang.String anIsSetMethodName,
           boolean bIsSetPerformedForAbsentNode,
           boolean bIsNullRepresentedByEmptyNode,
           boolean bIsNullRepresentedByXsiNil,
           XMLNullRepresentationType aMarshalNullRepresentation)Specific Constructor to set both the Marshal enum and the Unmarshal flags | |
| Method Summary | |
|---|---|
|  void | setSetPerformedForAbsentNode(boolean performSet)Set the isSetPerformedForAbsentNode flag | 
|  void | xPathNode(org.eclipse.persistence.internal.oxm.XPathNode xPathNode,
          org.eclipse.persistence.internal.oxm.NullCapableValue nullCapableValue)INTERNAL: When using the SAX Platform this allows a NodeValue to be registered to receive events from the TreeObjectBuilder. | 
| Methods inherited from class org.eclipse.persistence.oxm.mappings.nullpolicy.AbstractNullPolicy | 
|---|
| compositeObjectMarshal, compositeObjectMarshal, directMarshal, getIsSetPerformedForAbsentNode, getMarshalNullRepresentation, isNullRepresentedByEmptyNode, isNullRepresentedByXsiNil, processNamespaceResolverForXSIPrefix, setMarshalNullRepresentation, setNullRepresentedByEmptyNode, setNullRepresentedByXsiNil, valueIsNull, valueIsNull | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public NullPolicy()
public NullPolicy(java.lang.String anIsSetMethodName,
                  boolean bIsSetPerformedForAbsentNode,
                  boolean bIsNullRepresentedByEmptyNode,
                  boolean bIsNullRepresentedByXsiNil)
anIsSetMethodName - bIsSetPerformedForAbsentNode - bIsNullRepresentedByEmptyNode - bIsNullRepresentedByXsiNil - 
public NullPolicy(java.lang.String anIsSetMethodName,
                  boolean bIsSetPerformedForAbsentNode,
                  boolean bIsNullRepresentedByEmptyNode,
                  boolean bIsNullRepresentedByXsiNil,
                  XMLNullRepresentationType aMarshalNullRepresentation)
anIsSetMethodName - bIsSetPerformedForAbsentNode - bIsNullRepresentedByEmptyNode - bIsNullRepresentedByXsiNil - aMarshalNullRepresentation - | Method Detail | 
|---|
public void xPathNode(org.eclipse.persistence.internal.oxm.XPathNode xPathNode,
                      org.eclipse.persistence.internal.oxm.NullCapableValue nullCapableValue)
AbstractNullPolicy
xPathNode in class AbstractNullPolicypublic void setSetPerformedForAbsentNode(boolean performSet)
performSet - | 
 | EclipseLink1.0 - 20080707 API Reference | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||