Package org.bson
Class AbstractBsonWriter.Context
java.lang.Object
org.bson.AbstractBsonWriter.Context
- Direct Known Subclasses:
BsonBinaryWriter.Context
,JsonWriter.Context
- Enclosing class:
- AbstractBsonWriter
The context for the writer. Records the parent context, creating a bread crumb trail to trace back up to the root context of the
reader. Also records the
BsonContextType
, indicating whether the writer is reading a document, array, or other
complex sub-structure.-
Constructor Summary
ConstructorDescriptionCreates a new instance, copying values from an existing context.Context
(AbstractBsonWriter.Context parentContext, BsonContextType contextType) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Copies the values from thisContext
into a new instance.Gets the current context type.Returns the parent context.
-
Constructor Details
-
Context
Creates a new instance, copying values from an existing context.- Parameters:
from
- theContext
to copy values from
-
Context
Creates a new instance.- Parameters:
parentContext
- the context of the parent nodecontextType
- the context type.
-
-
Method Details
-
getParentContext
Returns the parent context. Allows users of this context object to transition to this parent context.- Returns:
- the context that came before this one
-
getContextType
Gets the current context type.- Returns:
- the current context type.
-
copy
Copies the values from thisContext
into a new instance.- Returns:
- the new instance with the same values as this context.
-