Package com.fauna.types
Class NullDocument<T>
- java.lang.Object
-
- com.fauna.types.NullableDocument<T>
-
- com.fauna.types.NullDocument<T>
-
- Type Parameters:
T
- The type of the document content, although it will not contain an actual value.
public final class NullDocument<T> extends NullableDocument<T>
Represents a document that is explicitly null, providing information about the cause of its null state. This class extendsNullableDocument
and throws aNullDocumentException
when accessed.
-
-
Constructor Summary
Constructors Constructor Description NullDocument(java.lang.String id, Module coll, java.lang.String cause)
Constructs aNullDocument
with the specified ID, collection, and cause of nullity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Checks if this null document is equal to another object.T
get()
Throws aNullDocumentException
when called, as this document is explicitly null.java.lang.String
getCause()
Retrieves the cause of the document's null state.Module
getCollection()
Retrieves the collection associated with the null document.java.lang.String
getId()
Retrieves the ID of the null document.int
hashCode()
Returns a hash code value for this null document based on its ID, collection, and cause.-
Methods inherited from class com.fauna.types.NullableDocument
getUnderlyingValue
-
-
-
-
Constructor Detail
-
NullDocument
public NullDocument(java.lang.String id, Module coll, java.lang.String cause)
Constructs aNullDocument
with the specified ID, collection, and cause of nullity.- Parameters:
id
- The unique identifier of the document.coll
- The module (collection) to which this null document belongs.cause
- A description of the reason why the document is null.
-
-
Method Detail
-
getCause
public java.lang.String getCause()
Retrieves the cause of the document's null state.- Returns:
- A
String
describing the cause of the null document.
-
get
public T get()
Throws aNullDocumentException
when called, as this document is explicitly null.- Specified by:
get
in classNullableDocument<T>
- Returns:
- Never returns a value, as it always throws an exception.
- Throws:
NullDocumentException
- Always thrown to indicate that this is a null document.
-
getId
public java.lang.String getId()
Retrieves the ID of the null document.- Returns:
- A
String
representing the document's ID.
-
getCollection
public Module getCollection()
Retrieves the collection associated with the null document.- Returns:
- A
Module
representing the collection to which this null document belongs.
-
equals
public boolean equals(java.lang.Object o)
Checks if this null document is equal to another object. TwoNullDocument
objects are considered equal if they have the same ID, collection, and cause.- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- The object to compare with this null document for equality.- Returns:
true
if the specified object is equal to this null document; otherwise,false
.
-
hashCode
public int hashCode()
Returns a hash code value for this null document based on its ID, collection, and cause.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- An integer hash code for this null document.
-
-