Package com.fauna.types
Class NonNullDocument<T>
- java.lang.Object
-
- com.fauna.types.NullableDocument<T>
-
- com.fauna.types.NonNullDocument<T>
-
- Type Parameters:
T- The type of the document content.
public final class NonNullDocument<T> extends NullableDocument<T>
Represents a document that is guaranteed to have a non-null value. This class extendsNullableDocumentand enforces non-null data for the document by disallowing null values in its constructor.
-
-
Constructor Summary
Constructors Constructor Description NonNullDocument(T val)Constructs aNonNullDocumentwith the specified non-null value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)Checks if this document is equal to another object.Tget()Retrieves the non-null wrapped value of the document.TgetValue()Retrieves the non-null wrapped value of the document.inthashCode()Returns a hash code value for this document based on its non-null value.-
Methods inherited from class com.fauna.types.NullableDocument
getUnderlyingValue
-
-
-
-
Constructor Detail
-
NonNullDocument
public NonNullDocument(T val)
Constructs aNonNullDocumentwith the specified non-null value.- Parameters:
val- The document's content of typeT. Must not be null.- Throws:
java.lang.NullPointerException- ifvalis null.
-
-
Method Detail
-
get
public T get()
Retrieves the non-null wrapped value of the document.- Specified by:
getin classNullableDocument<T>- Returns:
- The non-null wrapped value of type
T.
-
getValue
public T getValue()
Retrieves the non-null wrapped value of the document. This method provides compatibility for default serialization.- Returns:
- The non-null wrapped value of type
T.
-
equals
public boolean equals(java.lang.Object o)
Checks if this document is equal to another object. TwoNonNullDocumentobjects are considered equal if they hold values of the same type and content.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- The object to compare with this document for equality.- Returns:
trueif the specified object is equal to this document; otherwise,false.
-
hashCode
public int hashCode()
Returns a hash code value for this document based on its non-null value.- Overrides:
hashCodein classjava.lang.Object- Returns:
- An integer hash code for this document.
-
-