public class DocumentContextHolder extends Object implements DocumentContext, WriteDocumentContext
DocumentContext
and WriteDocumentContext. It acts as a wrapper or a delegate around an instance of
DocumentContext, providing methods to interact with the encapsulated context.NOOP| Constructor and Description |
|---|
DocumentContextHolder() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
chainedElement()
Returns
true if this WriteDocumentContext is a
chained element. |
void |
chainedElement(boolean chainedElement)
Marks this
WriteDocumentContext as a chained element. |
void |
close()
Closes the
DocumentContext and releases any held resources. |
DocumentContext |
documentContext()
Retrieves the encapsulated
DocumentContext instance. |
void |
documentContext(DocumentContext dc)
Sets the encapsulated
DocumentContext instance to the provided value. |
long |
index()
Obtains the index of the last read operation from this source context.
|
boolean |
isClosed()
Determines if the DocumentContextHolder has been closed or not.
|
boolean |
isEmpty()
Checks if the writing context is empty.
|
boolean |
isMetaData()
Checks it the
DocumentContext is metadata. |
boolean |
isNotComplete() |
boolean |
isPresent()
Checks if the
DocumentContext is present. |
void |
reset()
Cleans up the
DocumentContext by invoking the close method, then discarding
any lingering state associated with it. |
int |
sourceId()
Retrieves the source ID associated with this context.
|
void |
start(boolean metaData)
Initializes the writing context with a specific metadata status.
|
@Nullable Wire |
wire()
Returns the
Wire associated with the Document. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisData, isOpen, rollbackIfNotComplete, rollbackOnClosepublic boolean isMetaData()
DocumentContextDocumentContext is metadata. If it is, true is
returned, otherwise false.isMetaData in interface DocumentContextpublic boolean isPresent()
DocumentContextDocumentContext is present. If it is, true is returned,
otherwise false.isPresent in interface DocumentContext@Nullable public @Nullable Wire wire()
DocumentContextWire associated with the Document. It is possible that
null is returned, depending on the implementation.wire in interface DocumentContextWire associated with the Document.public boolean isNotComplete()
isNotComplete in interface DocumentContextpublic DocumentContext documentContext()
DocumentContext instance.DocumentContext instance.public void documentContext(DocumentContext dc)
DocumentContext instance to the provided value.dc - The new DocumentContext to be set.public void close()
DocumentContextDocumentContext and releases any held resources.
It is crucial to ensure that this method is invoked after the context's operations are completed
to prevent any potential resource leaks or data corruption.close in interface Closeableclose in interface AutoCloseableclose in interface DocumentContextpublic void reset()
DocumentContextDocumentContext by invoking the close method, then discarding
any lingering state associated with it. This provides a way to ensure the context
is in a fresh state and free of any residual data or settings.reset in interface DocumentContextpublic int sourceId()
SourceContextsourceId in interface SourceContextpublic long index()
throws net.openhft.chronicle.core.io.IORuntimeException
SourceContextindex in interface SourceContextnet.openhft.chronicle.core.io.IORuntimeException - if any issue arises while fetching the index.public boolean isClosed()
DocumentContext is null, indicating a closed state.true if the holder is closed (i.e., the internal DocumentContext is null),
false otherwise.public void start(boolean metaData)
WriteDocumentContextstart in interface WriteDocumentContextmetaData - A boolean value indicating if the context is metadata.public boolean chainedElement()
WriteDocumentContexttrue if this WriteDocumentContext is a
chained element.chainedElement in interface WriteDocumentContexttrue if this WriteDocumentContext is a
chained element; otherwise, false.public void chainedElement(boolean chainedElement)
WriteDocumentContextWriteDocumentContext as a chained element.chainedElement in interface WriteDocumentContextchainedElement - A boolean value indicating if the context
is a chained element.public boolean isEmpty()
WriteDocumentContextisEmpty in interface WriteDocumentContexttrue if the context is empty; otherwise, false.Copyright © 2024. All rights reserved.