Package org.bson
Class AbstractBsonWriter.Context
- java.lang.Object
-
- org.bson.AbstractBsonWriter.Context
-
- Direct Known Subclasses:
BsonBinaryWriter.Context
,JsonWriter.Context
- Enclosing class:
- AbstractBsonWriter
public class AbstractBsonWriter.Context extends Object
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 theBsonContextType
, indicating whether the writer is reading a document, array, or other complex sub-structure.
-
-
Constructor Summary
Constructors Constructor Description Context(AbstractBsonWriter.Context from)
Creates a new instance, copying values from an existing context.Context(AbstractBsonWriter.Context parentContext, BsonContextType contextType)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbstractBsonWriter.Context
copy()
Copies the values from thisContext
into a new instance.BsonContextType
getContextType()
Gets the current context type.AbstractBsonWriter.Context
getParentContext()
Returns the parent context.
-
-
-
Constructor Detail
-
Context
public Context(AbstractBsonWriter.Context from)
Creates a new instance, copying values from an existing context.- Parameters:
from
- theContext
to copy values from
-
Context
public Context(AbstractBsonWriter.Context parentContext, BsonContextType contextType)
Creates a new instance.- Parameters:
parentContext
- the context of the parent nodecontextType
- the context type.
-
-
Method Detail
-
getParentContext
public AbstractBsonWriter.Context 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
public BsonContextType getContextType()
Gets the current context type.- Returns:
- the current context type.
-
copy
public AbstractBsonWriter.Context copy()
Copies the values from thisContext
into a new instance.- Returns:
- the new instance with the same values as this context.
-
-