Package info.archinnov.achilles.internal.metadata.holder

Examples of info.archinnov.achilles.internal.metadata.holder.PropertyMeta.type()


        log.trace("Get value from field {} on real object", propertyMeta.getPropertyName());
        Object rawValue = invoker.getValueFromField(target, propertyMeta.getField());

        // Build proxy when necessary
        switch (propertyMeta.type()) {
            case COUNTER:
                if (rawValue == null) {
                    final Counter counter = InternalCounterBuilder.initialValue(null);
                    propertyMeta.forValues().setValueToField(target, counter);
                }
View Full Code Here


        DirtyChecker dirtyChecker = null;
        boolean removeField = false;
        if (args[0] == null) {
            removeField = true;
        }
        switch (propertyMeta.type()) {
            case SIMPLE:
                dirtyChecker = new SimpleDirtyChecker(propertyMeta);
                break;
            case SET:
                dirtyChecker = new DirtyChecker(propertyMeta);
View Full Code Here

        assertThat(meta.getGetter().getName()).isEqualTo("getName");
        assertThat((Class<String>) meta.getGetter().getReturnType()).isEqualTo(String.class);
        assertThat(meta.getSetter().getName()).isEqualTo("setName");
        assertThat((Class<String>) meta.getSetter().getParameterTypes()[0]).isEqualTo(String.class);

        assertThat(meta.type()).isEqualTo(PropertyType.SIMPLE);

        assertThat(context.getPropertyMetas().get("name")).isSameAs(meta);

    }
View Full Code Here

        }
        PropertyParsingContext context = newContext(Test.class, Test.class.getDeclaredField("counter"));

        PropertyMeta meta = parser.parse(context);

        assertThat(meta.type()).isEqualTo(PropertyType.COUNTER);
        assertThat(meta.getCounterProperties()).isNotNull();
        assertThat(meta.getCounterProperties().getFqcn()).isEqualTo(Test.class.getCanonicalName());
        assertThat(context.getCounterMetas().get(0)).isSameAs(meta);
    }
View Full Code Here

        entityContext.setCurrentConsistencyLevels(Pair.create(TWO, THREE));
        PropertyParsingContext context = entityContext.newPropertyContext(Test.class.getDeclaredField("counter"));

        PropertyMeta meta = parser.parse(context);

        assertThat(meta.type()).isEqualTo(PropertyType.COUNTER);
        assertThat(meta.structure().getReadConsistencyLevel()).isEqualTo(ONE);
        assertThat(meta.structure().getWriteConsistencyLevel()).isEqualTo(ALL);
    }

    @Test
View Full Code Here

        assertThat(meta.getGetter().getName()).isEqualTo("getFriends");
        assertThat((Class<List>) meta.getGetter().getReturnType()).isEqualTo(List.class);
        assertThat(meta.getSetter().getName()).isEqualTo("setFriends");
        assertThat((Class<List>) meta.getSetter().getParameterTypes()[0]).isEqualTo(List.class);

        assertThat(meta.type()).isEqualTo(PropertyType.LIST);
        assertThat(meta.forValues().nullValueForCollectionAndMap()).isNotNull().isInstanceOf(List.class);
        assertThat(meta.structure().isStaticColumn()).isTrue();

        PropertyParsingContext context2 = newContext(Test.class, Test.class.getDeclaredField("mates"));
        PropertyMeta meta2 = parser.parse(context2);
View Full Code Here

        assertThat(meta.forValues().nullValueForCollectionAndMap()).isNotNull().isInstanceOf(List.class);
        assertThat(meta.structure().isStaticColumn()).isTrue();

        PropertyParsingContext context2 = newContext(Test.class, Test.class.getDeclaredField("mates"));
        PropertyMeta meta2 = parser.parse(context2);
        assertThat(meta2.type()).isEqualTo(PropertyType.LIST);
        assertThat(meta2.forValues().nullValueForCollectionAndMap()).isNotNull().isInstanceOf(List.class);
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    @Test
View Full Code Here

        assertThat(creator.<UserBean>getValueClass()).isEqualTo(UserBean.class);
        assertThat(creator.type()).isEqualTo(SIMPLE);

        assertThat(count.getPropertyName()).isEqualTo("count");
        assertThat(count.<Counter>getValueClass()).isEqualTo(Counter.class);
        assertThat(count.type()).isEqualTo(COUNTER);

        assertThat(meta.config().getReadConsistencyLevel()).isEqualTo(ConsistencyLevel.ONE);
        assertThat(meta.config().getWriteConsistencyLevel()).isEqualTo(ConsistencyLevel.ALL);

        assertThat(meta.getAllMetasExceptIdAndCounters()).hasSize(6).containsOnly(name, age, friends, followers, preferences, creator);
View Full Code Here

        assertThat(meta.getGetter().getName()).isEqualTo("getFollowers");
        assertThat((Class<Set>) meta.getGetter().getReturnType()).isEqualTo(Set.class);
        assertThat(meta.getSetter().getName()).isEqualTo("setFollowers");
        assertThat((Class<Set>) meta.getSetter().getParameterTypes()[0]).isEqualTo(Set.class);

        assertThat(meta.type()).isEqualTo(PropertyType.SET);
        assertThat(meta.structure().isStaticColumn()).isTrue();
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    @Test
View Full Code Here

        PropertyParsingContext context = newContext(Test.class, Test.class.getDeclaredField("preferences"));
        PropertyMeta meta = parser.parse(context);

        assertThat(meta.getPropertyName()).isEqualTo("preferences");
        assertThat(meta.<String>getValueClass()).isEqualTo(String.class);
        assertThat(meta.type()).isEqualTo(PropertyType.MAP);

        assertThat(meta.<Integer>getKeyClass()).isEqualTo(Integer.class);

        assertThat(meta.getGetter().getName()).isEqualTo("getPreferences");
        assertThat((Class<Map>) meta.getGetter().getReturnType()).isEqualTo(Map.class);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.