org.eclipse.persistence.oxm.mappings.nullpolicy
Class AbstractNullPolicy

java.lang.Object
  extended by org.eclipse.persistence.oxm.mappings.nullpolicy.AbstractNullPolicy
Direct Known Subclasses:
IsSetNullPolicy, NullPolicy

public abstract class AbstractNullPolicy
extends Object

PUBLIC: Description: This node null policy allows for the handling of various representations of null in XML documents.

Null policies have 2 concrete implementations:

Unmarshal Flag Description
isSetPerformedForAbsentNode This umarshal flag represents whether a set is done for absent nodes only.
isNullRepresentedByEmptyNode If this unmarshal flag is false for empty nodes we set an empty Object for composite mappings, otherwise we set to null.
isNullRepresentedByXsiNil If this unmarshal flag is false for xsi:nil nodes we ignore the xsi:nil attribute and treat as an empty node.
Otherwise we set to null.

Marshal Enum XMLNullRepresentationType Description
XSI_NIL Nillable: Write out an xsi:nil="true" attribute.
ABSENT_NODE(default) Optional: Write out no node.
EMPTY_NODE Required: Write out an empty or node="" node.
 Usage:

Since:
Oracle TopLink 11g Release 1 (11.1.1)
See Also:
NullCapableValue

Constructor Summary
AbstractNullPolicy()
           
 
Method Summary
 boolean compositeObjectMarshal(XMLRecord record, Object object, XMLField field, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: When using the DOM Platform, this method is responsible for marshalling null values for the XML Composite Object Mapping.
 boolean compositeObjectMarshal(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, Session session, NamespaceResolver namespaceResolver)
          INTERNAL: When using the SAX Platform, this method is responsible for marshalling null values for the XML Composite Object Mapping.
 boolean directMarshal(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, Session session, NamespaceResolver namespaceResolver)
          INTERNAL: When using the SAX or DOM Platform, this method is responsible for marshalling null values for the XML Direct Mapping.
 boolean getIsSetPerformedForAbsentNode()
           
 XMLNullRepresentationType getMarshalNullRepresentation()
          Get the enum that determines what XML to write when a null value is encountered.
 boolean isNullRepresentedByEmptyNode()
           
 boolean isNullRepresentedByXsiNil()
           
 void setMarshalNullRepresentation(XMLNullRepresentationType anEnumInstance)
          Set the enum that determines what XML to write when a null value is encountered.
 void setNullRepresentedByEmptyNode(boolean bisNullRepresentedByEmptyNode)
           
 void setNullRepresentedByXsiNil(boolean bIsNullRepresentedByXsiNil)
           
 boolean valueIsNull(Attributes attributes)
          INTERNAL: When using the SAX or DOM Platform during unmarshal operations.
 boolean valueIsNull(Element element)
          INTERNAL: When using the DOM Platform during unmarshal operations.
abstract  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 java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractNullPolicy

public AbstractNullPolicy()
Method Detail

getMarshalNullRepresentation

public XMLNullRepresentationType getMarshalNullRepresentation()
Get the enum that determines what XML to write when a null value is encountered.

Parameters:
enumValue -

setMarshalNullRepresentation

public void setMarshalNullRepresentation(XMLNullRepresentationType anEnumInstance)
Set the enum that determines what XML to write when a null value is encountered.

Parameters:
enumValue -

directMarshal

public boolean directMarshal(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment,
                             MarshalRecord marshalRecord,
                             Object object,
                             Session session,
                             NamespaceResolver namespaceResolver)
INTERNAL: When using the SAX or DOM Platform, this method is responsible for marshalling null values for the XML Direct Mapping.

Parameters:
xPathFragment -
marshalRecord -
object -
session -
namespaceResolver -
Returns:
true if this method caused any nodes to be marshaled, else false.

compositeObjectMarshal

public boolean compositeObjectMarshal(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment,
                                      MarshalRecord marshalRecord,
                                      Object object,
                                      Session session,
                                      NamespaceResolver namespaceResolver)
INTERNAL: When using the SAX Platform, this method is responsible for marshalling null values for the XML Composite Object Mapping.

Parameters:
xPathFragment -
marshalRecord -
object -
session -
namespaceResolver -
Returns:
true if this method caused any nodes to be marshaled, else false.

compositeObjectMarshal

public boolean compositeObjectMarshal(XMLRecord record,
                                      Object object,
                                      XMLField field,
                                      org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: When using the DOM Platform, this method is responsible for marshalling null values for the XML Composite Object Mapping.

Parameters:
record -
object -
field -
Returns:
true if this method caused any objects to be marshaled, else false.

valueIsNull

public boolean valueIsNull(Attributes attributes)
INTERNAL: When using the SAX or DOM Platform during unmarshal operations. Use the attributes to determine if the element represents a null value.

Parameters:
attributes -
Returns:
true if based on the attributes the corresponding element represents a null value, else false.

valueIsNull

public boolean valueIsNull(Element element)
INTERNAL: When using the DOM Platform during unmarshal operations. Use the element to determine if the element represents a null value.

Returns:
true if based on the element it represents a null value, else false.

xPathNode

public abstract 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.

Parameters:
xPathNode -
nullCapableValue -

getIsSetPerformedForAbsentNode

public boolean getIsSetPerformedForAbsentNode()
Returns:
the isSetPerformedForAbsentNode flag

isNullRepresentedByEmptyNode

public boolean isNullRepresentedByEmptyNode()
Returns:

setNullRepresentedByEmptyNode

public void setNullRepresentedByEmptyNode(boolean bisNullRepresentedByEmptyNode)
Parameters:
bIsNullRepresentedByEmptyNode -

isNullRepresentedByXsiNil

public boolean isNullRepresentedByXsiNil()
Returns:

setNullRepresentedByXsiNil

public void setNullRepresentedByXsiNil(boolean bIsNullRepresentedByXsiNil)
Parameters:
isNullRepresentedByXsiNil -