Search in sources :

Example 1 with AbstractMongoConverter

use of org.springframework.data.mongodb.core.convert.AbstractMongoConverter in project spring-data-mongodb by spring-projects.

the class MongoOperationsUnitTests method operationsSetUp.

@BeforeEach
public final void operationsSetUp() {
    person = new Person("Oliver");
    persons = Arrays.asList(person);
    converter = new AbstractMongoConverter(null) {

        public void write(Object t, Bson bson) {
            ((Document) bson).put("firstName", person.getFirstName());
        }

        @SuppressWarnings("unchecked")
        public <S extends Object> S read(Class<S> clazz, Bson bson) {
            return (S) person;
        }

        public MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> getMappingContext() {
            return null;
        }

        public Object convertToMongoType(Object obj, TypeInformation<?> typeInformation) {
            return null;
        }

        public DBRef toDBRef(Object object, MongoPersistentProperty referingProperty) {
            return null;
        }

        @Override
        public MongoTypeMapper getTypeMapper() {
            return null;
        }

        @Override
        public ProjectionFactory getProjectionFactory() {
            return null;
        }

        @Override
        public CustomConversions getCustomConversions() {
            return null;
        }

        @Override
        public <R> R project(EntityProjection<R, ?> descriptor, Bson bson) {
            return null;
        }
    };
}
Also used : ProjectionFactory(org.springframework.data.projection.ProjectionFactory) MongoPersistentProperty(org.springframework.data.mongodb.core.mapping.MongoPersistentProperty) CustomConversions(org.springframework.data.convert.CustomConversions) DBRef(com.mongodb.DBRef) AbstractMongoConverter(org.springframework.data.mongodb.core.convert.AbstractMongoConverter) Bson(org.bson.conversions.Bson) MappingContext(org.springframework.data.mapping.context.MappingContext) MongoPersistentEntity(org.springframework.data.mongodb.core.mapping.MongoPersistentEntity) MongoTypeMapper(org.springframework.data.mongodb.core.convert.MongoTypeMapper) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

DBRef (com.mongodb.DBRef)1 Bson (org.bson.conversions.Bson)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 CustomConversions (org.springframework.data.convert.CustomConversions)1 MappingContext (org.springframework.data.mapping.context.MappingContext)1 AbstractMongoConverter (org.springframework.data.mongodb.core.convert.AbstractMongoConverter)1 MongoTypeMapper (org.springframework.data.mongodb.core.convert.MongoTypeMapper)1 MongoPersistentEntity (org.springframework.data.mongodb.core.mapping.MongoPersistentEntity)1 MongoPersistentProperty (org.springframework.data.mongodb.core.mapping.MongoPersistentProperty)1 ProjectionFactory (org.springframework.data.projection.ProjectionFactory)1