Class AbstractNullPolicy

  • Direct Known Subclasses:
    IsSetNullPolicy, NullPolicy

    public abstract class AbstractNullPolicy
    extends java.lang.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:

    • NullPolicy (default implementation)
    • IsSetNullPolicy (keyed off isSet() state of the node)
    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 <node/> or node="" node.
     Usage:
    See Also:
    NullCapableValue
    Since:
    Oracle TopLink 11g Release 1 (11.1.1)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.lang.String COLON_W_SCHEMA_NIL_ATTRIBUTE  
      protected boolean ignoreAttributesForNil
      This state flag determines how we unmarshal xsi:nil nodes when there are other attributes (other than xsi:nil) present.
      protected boolean isNullRepresentedByEmptyNode
      This state flag determines how we unmarshal empty nodes. true = Perform a set(null) or primitive type equivalent. false = (default) Perform a set(new Object()).
      protected boolean isNullRepresentedByXsiNil
      This state flag determines how we unmarshal xsi:nil nodes.
      protected boolean isSetPerformedForAbsentNode
      This state flag determines how we unmarshal absent nodes. true = (default) Perform a set(null). false = Do not perform a set(null).
      protected XMLNullRepresentationType marshalNullRepresentation
      This enum instance determines what to write out during a marshal operation.
      protected static java.lang.String TRUE  
      protected static java.lang.String XSI_NIL_ATTRIBUTE  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean compositeObjectMarshal​(org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecord record, java.lang.Object object, org.eclipse.persistence.internal.oxm.mappings.Field field, org.eclipse.persistence.internal.core.sessions.CoreAbstractSession 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, org.eclipse.persistence.internal.oxm.record.MarshalRecord marshalRecord, java.lang.Object object, CoreSession session, org.eclipse.persistence.internal.oxm.NamespaceResolver namespaceResolver)
      INTERNAL: When using the SAX Platform, this method is responsible for marshalling null values for the XML Composite Object Mapping.
      void directMarshal​(org.eclipse.persistence.internal.oxm.mappings.Field field, org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecord record, java.lang.Object object)
      INTERNAL
      boolean directMarshal​(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment, org.eclipse.persistence.internal.oxm.record.MarshalRecord marshalRecord, java.lang.Object object, CoreSession session, org.eclipse.persistence.internal.oxm.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 ignoreAttributesForNil()  
      boolean isNullRepresentedByEmptyNode()  
      boolean isNullRepresentedByXsiNil()  
      protected java.lang.String processNamespaceResolverForXSIPrefix​(org.eclipse.persistence.internal.oxm.NamespaceResolver namespaceResolver, org.eclipse.persistence.internal.oxm.record.MarshalRecord marshalRecord)
      INTERNAL: Private function to process or create an entry in the NamespaceResolver for the xsi prefix.
      void setIgnoreAttributesForNil​(boolean ignoreAttributesForNil)  
      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​(org.w3c.dom.Element element)
      INTERNAL: When using the DOM Platform during unmarshal operations.
      boolean valueIsNull​(org.xml.sax.Attributes attributes)
      INTERNAL: When using the SAX or 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

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COLON_W_SCHEMA_NIL_ATTRIBUTE

        protected static final java.lang.String COLON_W_SCHEMA_NIL_ATTRIBUTE
        See Also:
        Constant Field Values
      • XSI_NIL_ATTRIBUTE

        protected static final java.lang.String XSI_NIL_ATTRIBUTE
        See Also:
        Constant Field Values
      • isSetPerformedForAbsentNode

        protected boolean isSetPerformedForAbsentNode
        This state flag determines how we unmarshal absent nodes. true = (default) Perform a set(null). false = Do not perform a set(null).
      • isNullRepresentedByEmptyNode

        protected boolean isNullRepresentedByEmptyNode
        This state flag determines how we unmarshal empty nodes. true = Perform a set(null) or primitive type equivalent. false = (default) Perform a set(new Object()).
      • isNullRepresentedByXsiNil

        protected boolean isNullRepresentedByXsiNil
        This state flag determines how we unmarshal xsi:nil nodes. A set is performed in both cases. true = Perform a set(null) or primitive type equivalent.. false = (default) do nothing and treat as an empty node.
      • ignoreAttributesForNil

        protected boolean ignoreAttributesForNil
        This state flag determines how we unmarshal xsi:nil nodes when there are other attributes (other than xsi:nil) present. If false, we ignore any attributes and treat the element as nil. If true, we inspect if some attributes are present and if yes, we process them.
      • marshalNullRepresentation

        protected XMLNullRepresentationType marshalNullRepresentation
        This enum instance determines what to write out during a marshal operation. We are defaulting to ABSENT_NODE
    • 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.
      • setMarshalNullRepresentation

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

        public boolean directMarshal​(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment,
                                     org.eclipse.persistence.internal.oxm.record.MarshalRecord marshalRecord,
                                     java.lang.Object object,
                                     CoreSession session,
                                     org.eclipse.persistence.internal.oxm.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,
                                              org.eclipse.persistence.internal.oxm.record.MarshalRecord marshalRecord,
                                              java.lang.Object object,
                                              CoreSession session,
                                              org.eclipse.persistence.internal.oxm.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​(org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecord record,
                                              java.lang.Object object,
                                              org.eclipse.persistence.internal.oxm.mappings.Field field,
                                              org.eclipse.persistence.internal.core.sessions.CoreAbstractSession 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​(org.xml.sax.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​(org.w3c.dom.Element element)
        INTERNAL: When using the DOM Platform during unmarshal operations. Use the element to determine if the element represents a null value.
        Parameters:
        element -
        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:
        bIsNullRepresentedByXsiNil -
      • ignoreAttributesForNil

        public boolean ignoreAttributesForNil()
        Returns:
      • setIgnoreAttributesForNil

        public void setIgnoreAttributesForNil​(boolean ignoreAttributesForNil)
        Parameters:
        ignoreAttributesForNil -
      • processNamespaceResolverForXSIPrefix

        protected java.lang.String processNamespaceResolverForXSIPrefix​(org.eclipse.persistence.internal.oxm.NamespaceResolver namespaceResolver,
                                                                        org.eclipse.persistence.internal.oxm.record.MarshalRecord marshalRecord)
        INTERNAL: Private function to process or create an entry in the NamespaceResolver for the xsi prefix.
        Parameters:
        namespaceResolver -
        Returns:
        xsi prefix
      • directMarshal

        public void directMarshal​(org.eclipse.persistence.internal.oxm.mappings.Field field,
                                  org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecord record,
                                  java.lang.Object object)
        INTERNAL