Package com.fauna.types
Class NullableDocument<T>
- java.lang.Object
-
- com.fauna.types.NullableDocument<T>
-
- Type Parameters:
T
- The type of the document's content.
- Direct Known Subclasses:
NonNullDocument
,NullDocument
public abstract class NullableDocument<T> extends java.lang.Object
Represents a generic document wrapper that may hold a value representing a document. This abstract class provides a base for documents that can optionally hold a value.
-
-
Constructor Summary
Constructors Constructor Description NullableDocument()
Constructs aNullableDocument
without a value, initializing it tonull
.NullableDocument(T val)
Constructs aNullableDocument
with the specified value.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract T
get()
Retrieves the document's value.protected T
getUnderlyingValue()
Provides protected access to the underlying value, allowing subclasses to directly access the stored value without additional logic.
-
-
-
Constructor Detail
-
NullableDocument
public NullableDocument()
Constructs aNullableDocument
without a value, initializing it tonull
.
-
NullableDocument
public NullableDocument(T val)
Constructs aNullableDocument
with the specified value.- Parameters:
val
- The value to wrap, which may be null.
-
-
Method Detail
-
get
public abstract T get()
Retrieves the document's value. This method must be implemented by subclasses to specify how the value should be accessed.- Returns:
- The document's content of type
T
.
-
getUnderlyingValue
protected T getUnderlyingValue()
Provides protected access to the underlying value, allowing subclasses to directly access the stored value without additional logic.- Returns:
- The underlying value of type
T
, which may benull
.
-
-