Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2017-2022 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.data.mongodb.serde;
import io.micronaut.context.BeanContext;
import io.micronaut.core.annotation.Internal;
import io.micronaut.core.annotation.Order;
import io.micronaut.core.beans.BeanIntrospection;
import io.micronaut.core.beans.BeanProperty;
import io.micronaut.core.convert.ConversionService;
import io.micronaut.core.order.Ordered;
import io.micronaut.core.type.Argument;
import io.micronaut.data.document.serde.IdPropertyNamingStrategy;
import io.micronaut.data.document.serde.IdSerializer;
import io.micronaut.data.document.serde.ManyRelationSerializer;
import io.micronaut.data.document.serde.OneRelationSerializer;
import io.micronaut.data.model.runtime.AttributeConverterRegistry;
import io.micronaut.data.model.runtime.RuntimeEntityRegistry;
import io.micronaut.data.model.runtime.RuntimePersistentEntity;
import io.micronaut.data.mongodb.conf.MongoDataConfiguration;
import io.micronaut.data.mongodb.operations.MongoUtils;
import io.micronaut.serde.Deserializer;
import io.micronaut.serde.Encoder;
import io.micronaut.serde.Serde;
import io.micronaut.serde.SerdeIntrospections;
import io.micronaut.serde.SerdeRegistry;
import io.micronaut.serde.Serializer;
import io.micronaut.serde.config.DeserializationConfiguration;
import io.micronaut.serde.config.SerializationConfiguration;
import io.micronaut.serde.config.naming.PropertyNamingStrategy;
import io.micronaut.serde.exceptions.SerdeException;
import io.micronaut.serde.support.DefaultSerdeRegistry;
import io.micronaut.serde.support.deserializers.ObjectDeserializer;
import io.micronaut.serde.support.serializers.ObjectSerializer;
import jakarta.inject.Singleton;
import org.bson.codecs.configuration.CodecRegistry;
import java.io.IOException;
import java.util.Collection;
/**
* Micronaut Data serde registry.
*
* @author Denis Stepanov
* @since 3.3
*/
@Singleton
@Order(Ordered.LOWEST_PRECEDENCE)
@Internal
final class DataSerdeRegistry implements SerdeRegistry {
public static final IdPropertyNamingStrategy ID_PROPERTY_NAMING_STRATEGY = element -> MongoUtils.ID;
private final DefaultSerdeRegistry defaultSerdeRegistry;
private final RuntimeEntityRegistry runtimeEntityRegistry;
private final AttributeConverterRegistry attributeConverterRegistry;
private final MongoDataConfiguration mongoDataConfiguration;
/**
* Default constructor.
*
* @param beanContext The bean context
* @param serializationConfiguration The serializationConfiguration
* @param deserializationConfiguration The deserializationConfiguration
* @param objectArraySerde The object array Serde
* @param introspections The introspections
* @param runtimeEntityRegistry The runtimeEntityRegistry
* @param attributeConverterRegistry The attributeConverterRegistry
* @param mongoDataConfiguration The Mongo configuration
* @param conversionService The conversion service
*/
public DataSerdeRegistry(BeanContext beanContext,
SerializationConfiguration serializationConfiguration,
DeserializationConfiguration deserializationConfiguration,
Serde