Package org.mongodb.morphia.mapping

Examples of org.mongodb.morphia.mapping.Mapper


public class Morphia {
    private final Mapper mapper;
    private boolean useBulkWriteOperations = false;

    public Morphia() {
        this(new Mapper(), Collections.<Class>emptySet());
    }
View Full Code Here


    public Morphia(final Mapper mapper) {
        this(mapper, Collections.<Class>emptySet());
    }

    public Morphia(final Set<Class> classesToMap) {
        this(new Mapper(), classesToMap);
    }
View Full Code Here

public class GeoWithinOperationValidatorTest {
    @Test
    public void shouldAllowGeoWithinOperatorWithAllAppropriateTrimmings() {
        // given
        List<ValidationFailure> validationFailures = new ArrayList<ValidationFailure>();
        MappedClass mappedClass = new MappedClass(GeoEntity.class, new Mapper());
        MappedField mappedField = mappedClass.getMappedField("array");

        // when
        assertThat(GeoWithinOperationValidator.getInstance().apply(mappedField, GEO_WITHIN, new BasicDBObject("$box", 1),
                                                                   validationFailures), is(true));
View Full Code Here

    @Test
    public void shouldAllowGeoWithinOperatorForGeoEntityWithListOfIntegers() {
        // given
        List<ValidationFailure> validationFailures = new ArrayList<ValidationFailure>();
        MappedClass mappedClass = new MappedClass(GeoEntity.class, new Mapper());
        MappedField mappedField = mappedClass.getMappedField("list");
        assertThat(GeoWithinOperationValidator.getInstance().apply(mappedField,
                                                                   GEO_WITHIN,
                                                                   new BasicDBObject("$box", 1),
                                                                   validationFailures),
View Full Code Here

    @Test
    public void shouldRejectGeoWithinWhenValueDoesNotContainKeyword() {
        // given
        List<ValidationFailure> validationFailures = new ArrayList<ValidationFailure>();
        MappedClass mappedClass = new MappedClass(GeoEntity.class, new Mapper());
        MappedField mappedField = mappedClass.getMappedField("array");

        // when
        boolean validationApplied = GeoWithinOperationValidator.getInstance().apply(mappedField,
                                                                                    GEO_WITHIN,
View Full Code Here

    @Test
    public void shouldRejectGeoWithinWhenValueIsNotADBObject() {
        // given
        List<ValidationFailure> validationFailures = new ArrayList<ValidationFailure>();
        MappedClass mappedClass = new MappedClass(GeoEntity.class, new Mapper());
        MappedField mappedField = mappedClass.getMappedField("array");

        // when
        boolean validationApplied = GeoWithinOperationValidator.getInstance().apply(mappedField,
                                                                                    GEO_WITHIN,
View Full Code Here

    @Test
    public void shouldRejectGeoWithinOperatorWhenMappedFieldIsArrayThatDoesNotContainNumbers() {
        // given
        List<ValidationFailure> validationFailures = new ArrayList<ValidationFailure>();
        MappedClass mappedClass = new MappedClass(InvalidGeoEntity.class, new Mapper());
        MappedField mappedField = mappedClass.getMappedField("arrayOfStrings");

        // when
        boolean validationApplied = GeoWithinOperationValidator.getInstance().apply(mappedField,
                                                                                    GEO_WITHIN,
View Full Code Here

    @Test
    public void shouldRejectGeoWithinOperatorWhenMappedFieldIsListThatDoesNotContainNumbers() {
        // given
        List<ValidationFailure> validationFailures = new ArrayList<ValidationFailure>();
        MappedClass mappedClass = new MappedClass(InvalidGeoEntity.class, new Mapper());
        MappedField mappedField = mappedClass.getMappedField("listOfStrings");

        // when
        boolean validationApplied = GeoWithinOperationValidator.getInstance().apply(mappedField,
                                                                                    GEO_WITHIN,
View Full Code Here

public class SizeOperationValidatorTest {
    @Test
    public void shouldNotApplyValidationToOperatorThatIsNotSize() {
        // given
        MappedClass mappedClass = new MappedClass(EntityWithListsAndArrays.class, new Mapper());
        MappedField mappedField = mappedClass.getMappedField("list");
        List<ValidationFailure> validationFailures = new ArrayList<ValidationFailure>();

        // when
        boolean validationApplied = SizeOperationValidator.getInstance().apply(mappedField, EQUAL, 1, validationFailures);
View Full Code Here

    }

    @Test
    public void shouldAllowSizeOperatorForListTypesAndIntValues() {
        // given
        MappedClass mappedClass = new MappedClass(EntityWithListsAndArrays.class, new Mapper());
        MappedField mappedField = mappedClass.getMappedField("listOfIntegers");
        List<ValidationFailure> validationFailures = new ArrayList<ValidationFailure>();

        // when
        boolean validationApplied = SizeOperationValidator.getInstance().apply(mappedField, SIZE, 3, validationFailures);
View Full Code Here

TOP

Related Classes of org.mongodb.morphia.mapping.Mapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.