Skip to content

AbstractValue

@LowLevelApi



abstract class AbstractValue<Root : Any, Type> : Node, Value<Root, Type> 

Utility implementation of Value, which handles the context, toString representation and freezing.

Implementing a new operator

Implementing class is identical in concept to implementing AbstractBsonNode. The main difference is the writer is a BsonValueWriter instead of a BsonFieldWriter.

Constructors

AbstractValue

constructor(context: BsonContext)

Properties

context

@LowLevelApi



open override val context: BsonContext

The context used to generate this value.

Functions

freeze

@LowLevelApi



open override fun freeze()

Makes this node immutable.

simplify

@LowLevelApi



open override fun simplify(): AbstractValue<Root, Type>

Returns a simplified (but equivalent) value to the current value.

toString

fun toString(simplified: Boolean): String

JSON representation of this expression.

By default, simplifications are enabled. Set simplified to false to disable simplifications.

override fun toString(): String

JSON representation of this expression.

Note that since this class represents a BSON value, and BSON libraries often only support documents, the actual value may be surrounded by some boilerplate (like an array or a useless value).

writeTo

@LowLevelApi



override fun writeTo(writer: BsonValueWriter)

Writes the result of simplifying this value into writer.