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 extendsNullableDocumentand throws aNullDocumentExceptionwhen accessed.
-
-
Constructor Summary
Constructors Constructor Description NullDocument(java.lang.String id, Module coll, java.lang.String cause)Constructs aNullDocumentwith the specified ID, collection, and cause of nullity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)Checks if this null document is equal to another object.Tget()Throws aNullDocumentExceptionwhen called, as this document is explicitly null.java.lang.StringgetCause()Retrieves the cause of the document's null state.ModulegetCollection()Retrieves the collection associated with the null document.java.lang.StringgetId()Retrieves the ID of the null document.inthashCode()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 aNullDocumentwith 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
Stringdescribing the cause of the null document.
-
get
public T get()
Throws aNullDocumentExceptionwhen called, as this document is explicitly null.- Specified by:
getin 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
Stringrepresenting the document's ID.
-
getCollection
public Module getCollection()
Retrieves the collection associated with the null document.- Returns:
- A
Modulerepresenting 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. TwoNullDocumentobjects are considered equal if they have the same ID, collection, and cause.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- The object to compare with this null document for equality.- Returns:
trueif 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:
hashCodein classjava.lang.Object- Returns:
- An integer hash code for this null document.
-
-