Codec<Document>
, CollectibleCodec<Document>
, Decoder<Document>
, Encoder<Document>
, OverridableUuidRepresentationCodec<Document>
A Codec for Document instances.
Constructors
Construct a new instance with a default CodecRegistry
.
Construct a new instance with the given registry.
Construct a new instance with the given registry and BSON type class map.
Construct a new instance with the given registry and BSON type class map.
Decodes a BSON value from the given reader into an instance of the type parameter T
.
boolean
Returns true if the given document has an _id.
void
Encode an instance of the type parameter T
into a BSON value.
Generates a value for the _id field on the given document, if the document does not have one.
Gets the _id of the given document if it contains one, otherwise throws IllegalArgumentException
.
Returns the Class instance that this encodes.
Implementations must return a new instance with the UuidRepresentation
overridden with the given value.
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public DocumentCodec()
Construct a new instance with a default CodecRegistry
.
Construct a new instance with the given registry.
registry
- the registry
Construct a new instance with the given registry and BSON type class map.
registry
- the registry
bsonTypeClassMap
- the BSON type class map
Construct a new instance with the given registry and BSON type class map. The transformer is applied as a last step when decoding values, which allows users of this codec to control the decoding process. For example, a user of this class could substitute a value decoded as a Document with an instance of a special purpose class (e.g., one representing a DBRef in MongoDB).
registry
- the registry
bsonTypeClassMap
- the BSON type class map
valueTransformer
- the value transformer to use as a final step when decoding the value of any field in the document
Implementations must return a new instance with the UuidRepresentation
overridden with the given value.
withUuidRepresentation
in interface OverridableUuidRepresentationCodec<Document>
uuidRepresentation
- the UuidRepresentation
Returns true if the given document has an _id.
documentHasId
in interface CollectibleCodec<Document>
document
- the document in which to look for an _id
Gets the _id of the given document if it contains one, otherwise throws IllegalArgumentException
. To avoid the latter case, call documentHasId
first to check.
getDocumentId
in interface CollectibleCodec<Document>
document
- the document from which to get the _id
Generates a value for the _id field on the given document, if the document does not have one.
generateIdIfAbsentFromDocument
in interface CollectibleCodec<Document>
document
- the document for which to generate a value for the _id.
Encoder
Encode an instance of the type parameter T
into a BSON value.
Decoder
Decodes a BSON value from the given reader into an instance of the type parameter T
.
Encoder
Returns the Class instance that this encodes. This is necessary because Java does not reify generic types.
getEncoderClass
in interface Encoder<Document>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4