Module org.eclipse.persistence.core
Class AbstractNullPolicy
java.lang.Object
org.eclipse.persistence.oxm.mappings.nullpolicy.AbstractNullPolicy
- Direct Known Subclasses:
IsSetNullPolicy,NullPolicy
PUBLIC: Description: This node null policy allows for the handling of
various representations of null in XML documents.
Usage:
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. |
- Since:
- Oracle TopLink 11g Release 1 (11.1.1)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected booleanThis state flag determines how we unmarshal xsi:nil nodes when there are other attributes (other than xsi:nil) present.protected booleanThis state flag determines how we unmarshal empty nodes.protected booleanThis state flag determines how we unmarshal xsi:nil nodes.protected booleanThis state flag determines how we unmarshal absent nodes.protected XMLNullRepresentationTypeThis enum instance determines what to write out during a marshal operation.protected static final Stringprotected static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancompositeObjectMarshal(AbstractMarshalRecord record, Object object, Field field, CoreAbstractSession session) INTERNAL: When using the DOM Platform, this method is responsible for marshalling null values for the XML Composite Object Mapping.booleancompositeObjectMarshal(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, CoreSession session, NamespaceResolver namespaceResolver) INTERNAL: When using the SAX Platform, this method is responsible for marshalling null values for the XML Composite Object Mapping.voiddirectMarshal(Field field, AbstractMarshalRecord record, Object object) INTERNALbooleandirectMarshal(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, CoreSession session, NamespaceResolver namespaceResolver) INTERNAL: When using the SAX or DOM Platform, this method is responsible for marshalling null values for the XML Direct Mapping.booleanGet the enum that determines what XML to write when a null value is encountered.booleanbooleanbooleanprotected StringprocessNamespaceResolverForXSIPrefix(NamespaceResolver namespaceResolver, MarshalRecord marshalRecord) INTERNAL: Private function to process or create an entry in the NamespaceResolver for the xsi prefix.voidsetIgnoreAttributesForNil(boolean ignoreAttributesForNil) voidsetMarshalNullRepresentation(XMLNullRepresentationType anEnumInstance) Set the enum that determines what XML to write when a null value is encountered.voidsetNullRepresentedByEmptyNode(boolean bIsNullRepresentedByEmptyNode) voidsetNullRepresentedByXsiNil(boolean bIsNullRepresentedByXsiNil) booleanvalueIsNull(Element element) INTERNAL: When using the DOM Platform during unmarshal operations.booleanvalueIsNull(Attributes attributes) INTERNAL: When using the SAX or DOM Platform during unmarshal operations.abstract voidxPathNode(XPathNode xPathNode, NullCapableValue nullCapableValue) INTERNAL: When using the SAX Platform this allows a NodeValue to be registered to receive events from the TreeObjectBuilder.
-
Field Details
-
TRUE
- See Also:
-
COLON_W_SCHEMA_NIL_ATTRIBUTE
- See Also:
-
XSI_NIL_ATTRIBUTE
- See Also:
-
isSetPerformedForAbsentNode
protected boolean isSetPerformedForAbsentNodeThis state flag determines how we unmarshal absent nodes. true = (default) Perform a set(null). false = Do not perform a set(null). -
isNullRepresentedByEmptyNode
protected boolean isNullRepresentedByEmptyNodeThis 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 isNullRepresentedByXsiNilThis 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 ignoreAttributesForNilThis 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
This enum instance determines what to write out during a marshal operation. We are defaulting to ABSENT_NODE
-
-
Constructor Details
-
AbstractNullPolicy
protected AbstractNullPolicy()Default constructor.
-
-
Method Details
-
getMarshalNullRepresentation
Get the enum that determines what XML to write when a null value is encountered. -
setMarshalNullRepresentation
Set the enum that determines what XML to write when a null value is encountered. -
directMarshal
public boolean directMarshal(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, CoreSession session, NamespaceResolver namespaceResolver) INTERNAL: When using the SAX or DOM Platform, this method is responsible for marshalling null values for the XML Direct Mapping.- Returns:
- true if this method caused any nodes to be marshaled, else false.
-
compositeObjectMarshal
public boolean compositeObjectMarshal(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, CoreSession session, NamespaceResolver namespaceResolver) INTERNAL: When using the SAX Platform, this method is responsible for marshalling null values for the XML Composite Object Mapping.- Returns:
- true if this method caused any nodes to be marshaled, else false.
-
compositeObjectMarshal
public boolean compositeObjectMarshal(AbstractMarshalRecord record, Object object, Field field, CoreAbstractSession session) INTERNAL: When using the DOM Platform, this method is responsible for marshalling null values for the XML Composite Object Mapping.- Returns:
- true if this method caused any objects to be marshaled, else false.
-
valueIsNull
INTERNAL: When using the SAX or DOM Platform during unmarshal operations. Use the attributes to determine if the element represents a null value.- Returns:
- true if based on the attributes the corresponding element represents a null value, else false.
-
valueIsNull
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
INTERNAL: When using the SAX Platform this allows a NodeValue to be registered to receive events from the TreeObjectBuilder. -
getIsSetPerformedForAbsentNode
public boolean getIsSetPerformedForAbsentNode()- Returns:
- the isSetPerformedForAbsentNode flag
-
isNullRepresentedByEmptyNode
public boolean isNullRepresentedByEmptyNode() -
setNullRepresentedByEmptyNode
public void setNullRepresentedByEmptyNode(boolean bIsNullRepresentedByEmptyNode) -
isNullRepresentedByXsiNil
public boolean isNullRepresentedByXsiNil() -
setNullRepresentedByXsiNil
public void setNullRepresentedByXsiNil(boolean bIsNullRepresentedByXsiNil) -
ignoreAttributesForNil
public boolean ignoreAttributesForNil() -
setIgnoreAttributesForNil
public void setIgnoreAttributesForNil(boolean ignoreAttributesForNil) -
processNamespaceResolverForXSIPrefix
protected String processNamespaceResolverForXSIPrefix(NamespaceResolver namespaceResolver, MarshalRecord marshalRecord) INTERNAL: Private function to process or create an entry in the NamespaceResolver for the xsi prefix.- Returns:
- xsi prefix
-
directMarshal
INTERNAL
-