Class DocumentSerializationUtilsImpl


  • public class DocumentSerializationUtilsImpl
    extends Object
    Utilities for helping with serialisation
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.bson.UuidRepresentation attemptToExtractUuidRepresentation​(org.bson.codecs.configuration.CodecRegistry registry)  
      protected com.fasterxml.jackson.databind.JsonSerializer<?> findQuerySerializer​(boolean targetIsCollection, String fieldPath, com.fasterxml.jackson.databind.SerializerProvider serializerProvider, com.fasterxml.jackson.databind.JsonSerializer<?> serializer)  
      protected com.fasterxml.jackson.databind.JsonSerializer<?> findUpdateSerializer​(boolean targetIsCollection, String fieldPath, com.fasterxml.jackson.databind.SerializerProvider serializerProvider, com.fasterxml.jackson.databind.JsonSerializer<?> serializer)  
      protected com.fasterxml.jackson.databind.JsonSerializer<?> getJsonSerializerForContainer​(com.fasterxml.jackson.databind.SerializerProvider serializerProvider, com.fasterxml.jackson.databind.JsonSerializer<?> fieldSerializer)  
      boolean isKnownClass​(Class<?> value)  
      boolean isKnownType​(Object value)  
      protected boolean keyIsNotOperator​(String key)  
      org.bson.conversions.Bson serializeFields​(org.bson.conversions.Bson object, org.bson.codecs.configuration.CodecRegistry registry)
      Serialize the fields of the given object using the given object mapper.
      org.bson.conversions.Bson serializeFilter​(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.JavaType type, org.bson.conversions.Bson query, org.bson.codecs.configuration.CodecRegistry registry)  
      protected void serializeFilter​(com.fasterxml.jackson.databind.SerializerProvider serializerProvider, com.fasterxml.jackson.databind.JsonSerializer<?> serializer, Map<String,​Object> decoded, org.bson.BsonDocumentWriter writer, DBEncoderBsonGenerator generator)  
      protected void serializeFilter​(com.fasterxml.jackson.databind.SerializerProvider serializerProvider, com.fasterxml.jackson.databind.JsonSerializer<?> serializer, org.bson.conversions.Bson query, org.bson.codecs.configuration.CodecRegistry registry, org.bson.BsonDocumentWriter writer, DBEncoderBsonGenerator generator)  
      protected void serializeFilterCondition​(com.fasterxml.jackson.databind.SerializerProvider serializerProvider, com.fasterxml.jackson.databind.JsonSerializer<?> serializer, String key, Object condition, boolean targetIsCollection, org.bson.BsonDocumentWriter writer, DBEncoderBsonGenerator generator)  
      protected void serializeQueryField​(Object value, com.fasterxml.jackson.databind.JsonSerializer serializer, com.fasterxml.jackson.databind.SerializerProvider serializerProvider, org.bson.BsonDocumentWriter writer, DBEncoderBsonGenerator generator)  
      protected void serializeUpdateField​(Object value, com.fasterxml.jackson.databind.JsonSerializer serializer, com.fasterxml.jackson.databind.SerializerProvider serializerProvider, DBEncoderBsonGenerator generator)  
      protected void serializeUpdateField​(Object value, com.fasterxml.jackson.databind.SerializerProvider serializerProvider, org.bson.BsonDocumentWriter writer, DBEncoderBsonGenerator generator, org.bson.codecs.configuration.CodecRegistry registry)
      Serialize the given field
      protected void serializeUpdateField​(UpdateOperationValue value, com.fasterxml.jackson.databind.JsonSerializer<?> serializer, com.fasterxml.jackson.databind.SerializerProvider serializerProvider, org.bson.BsonDocumentWriter writer, DBEncoderBsonGenerator generator)  
      org.bson.conversions.Bson serializeUpdates​(Map<String,​Map<String,​UpdateOperationValue>> update, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.JavaType javaType, org.bson.codecs.configuration.CodecRegistry registry)  
      boolean writeKnownType​(Object value, org.bson.BsonWriter writer)  
    • Field Detail

      • BASIC_TYPES

        protected final Set<Class<?>> BASIC_TYPES
    • Constructor Detail

      • DocumentSerializationUtilsImpl

        protected DocumentSerializationUtilsImpl()
    • Method Detail

      • serializeFields

        public org.bson.conversions.Bson serializeFields​(org.bson.conversions.Bson object,
                                                         org.bson.codecs.configuration.CodecRegistry registry)
        Serialize the fields of the given object using the given object mapper. This will convert POJOs to Documents where necessary.
        Parameters:
        object - The object to serialize the fields of
        registry - Codec registry
        Returns:
        The Document, safe for serialization to MongoDB
      • keyIsNotOperator

        protected boolean keyIsNotOperator​(String key)
      • serializeQueryField

        protected void serializeQueryField​(Object value,
                                           com.fasterxml.jackson.databind.JsonSerializer serializer,
                                           com.fasterxml.jackson.databind.SerializerProvider serializerProvider,
                                           org.bson.BsonDocumentWriter writer,
                                           DBEncoderBsonGenerator generator)
                                    throws IOException
        Throws:
        IOException
      • writeKnownType

        public boolean writeKnownType​(Object value,
                                      org.bson.BsonWriter writer)
      • isKnownType

        public boolean isKnownType​(Object value)
      • isKnownClass

        public boolean isKnownClass​(Class<?> value)
      • serializeFilter

        public org.bson.conversions.Bson serializeFilter​(com.fasterxml.jackson.databind.ObjectMapper objectMapper,
                                                         com.fasterxml.jackson.databind.JavaType type,
                                                         org.bson.conversions.Bson query,
                                                         org.bson.codecs.configuration.CodecRegistry registry)
      • attemptToExtractUuidRepresentation

        protected org.bson.UuidRepresentation attemptToExtractUuidRepresentation​(org.bson.codecs.configuration.CodecRegistry registry)
      • serializeFilter

        protected void serializeFilter​(com.fasterxml.jackson.databind.SerializerProvider serializerProvider,
                                       com.fasterxml.jackson.databind.JsonSerializer<?> serializer,
                                       org.bson.conversions.Bson query,
                                       org.bson.codecs.configuration.CodecRegistry registry,
                                       org.bson.BsonDocumentWriter writer,
                                       DBEncoderBsonGenerator generator)
                                throws IOException
        Throws:
        IOException
      • serializeFilter

        protected void serializeFilter​(com.fasterxml.jackson.databind.SerializerProvider serializerProvider,
                                       com.fasterxml.jackson.databind.JsonSerializer<?> serializer,
                                       Map<String,​Object> decoded,
                                       org.bson.BsonDocumentWriter writer,
                                       DBEncoderBsonGenerator generator)
                                throws IOException
        Throws:
        IOException
      • serializeFilterCondition

        protected void serializeFilterCondition​(com.fasterxml.jackson.databind.SerializerProvider serializerProvider,
                                                com.fasterxml.jackson.databind.JsonSerializer<?> serializer,
                                                String key,
                                                Object condition,
                                                boolean targetIsCollection,
                                                org.bson.BsonDocumentWriter writer,
                                                DBEncoderBsonGenerator generator)
                                         throws IOException
        Throws:
        IOException
      • serializeUpdateField

        protected void serializeUpdateField​(Object value,
                                            com.fasterxml.jackson.databind.SerializerProvider serializerProvider,
                                            org.bson.BsonDocumentWriter writer,
                                            DBEncoderBsonGenerator generator,
                                            org.bson.codecs.configuration.CodecRegistry registry)
                                     throws IOException
        Serialize the given field
        Parameters:
        value - The value to serialize
        serializerProvider - A SerializerProvider
        registry - The codec registry to be used for serialization
        Throws:
        IOException
      • serializeUpdates

        public org.bson.conversions.Bson serializeUpdates​(Map<String,​Map<String,​UpdateOperationValue>> update,
                                                          com.fasterxml.jackson.databind.ObjectMapper objectMapper,
                                                          com.fasterxml.jackson.databind.JavaType javaType,
                                                          org.bson.codecs.configuration.CodecRegistry registry)
      • serializeUpdateField

        protected void serializeUpdateField​(UpdateOperationValue value,
                                            com.fasterxml.jackson.databind.JsonSerializer<?> serializer,
                                            com.fasterxml.jackson.databind.SerializerProvider serializerProvider,
                                            org.bson.BsonDocumentWriter writer,
                                            DBEncoderBsonGenerator generator)
                                     throws IOException
        Throws:
        IOException
      • serializeUpdateField

        protected void serializeUpdateField​(Object value,
                                            com.fasterxml.jackson.databind.JsonSerializer serializer,
                                            com.fasterxml.jackson.databind.SerializerProvider serializerProvider,
                                            DBEncoderBsonGenerator generator)
                                     throws IOException
        Throws:
        IOException
      • findUpdateSerializer

        protected com.fasterxml.jackson.databind.JsonSerializer<?> findUpdateSerializer​(boolean targetIsCollection,
                                                                                        String fieldPath,
                                                                                        com.fasterxml.jackson.databind.SerializerProvider serializerProvider,
                                                                                        com.fasterxml.jackson.databind.JsonSerializer<?> serializer)
      • getJsonSerializerForContainer

        protected com.fasterxml.jackson.databind.JsonSerializer<?> getJsonSerializerForContainer​(com.fasterxml.jackson.databind.SerializerProvider serializerProvider,
                                                                                                 com.fasterxml.jackson.databind.JsonSerializer<?> fieldSerializer)
      • findQuerySerializer

        protected com.fasterxml.jackson.databind.JsonSerializer<?> findQuerySerializer​(boolean targetIsCollection,
                                                                                       String fieldPath,
                                                                                       com.fasterxml.jackson.databind.SerializerProvider serializerProvider,
                                                                                       com.fasterxml.jackson.databind.JsonSerializer<?> serializer)