Package info.archinnov.achilles.internal.metadata.codec

Examples of info.archinnov.achilles.internal.metadata.codec.MapCodec.encode()


        Field field = Test.class.getDeclaredField("maps");

        //When
        final MapCodec codec = factory.parseMapField(createContext(field));
        Map<Object, Object> encoded = codec.encode(ImmutableMap.<Object, Object>of(PropertyType.COUNTER, ElementType.FIELD, PropertyType.ID, ElementType.METHOD));
        Map<Object, Object> decoded = codec.decode(ImmutableMap.<Object, Object>of("LIST", "CONSTRUCTOR", "SET", "PARAMETER"));

        //Then
        assertThat(encoded.get("COUNTER")).isEqualTo("FIELD");
        assertThat(encoded.get("ID")).isEqualTo("METHOD");
View Full Code Here


        Field field = Test.class.getDeclaredField("maps");

        //When
        final MapCodec codec = factory.parseMapField(createContext(field));
        Map<Object, Object> encoded = codec.encode(ImmutableMap.<Object, Object>of(PropertyType.ID, ElementType.FIELD, PropertyType.EMBEDDED_ID, ElementType.METHOD));
        Map<Object, Object> decoded = codec.decode(ImmutableMap.<Object, Object>of(3, "CONSTRUCTOR", 4, "PARAMETER"));

        //Then
        assertThat(encoded.get(0)).isEqualTo("FIELD");
        assertThat(encoded.get(1)).isEqualTo("METHOD");
View Full Code Here

        Field field = Test.class.getDeclaredField("maps");

        //When
        final MapCodec codec = factory.parseMapField(createContext(field));
        Map<Object, Object> encoded = codec.encode(ImmutableMap.<Object, Object>of(1, PropertyType.COUNTER, 2, PropertyType.ID));
        Map<Object, Object> decoded = codec.decode(ImmutableMap.<Object, Object>of(3, "LIST", 4, "SET"));

        //Then
        assertThat(encoded.get(1)).isEqualTo("COUNTER");
        assertThat(encoded.get(2)).isEqualTo("ID");
View Full Code Here

        Field field = Test.class.getDeclaredField("maps");

        //When
        final MapCodec codec = factory.parseMapField(createContext(field));
        Map<Object, Object> encoded = codec.encode(ImmutableMap.<Object, Object>of(1, PropertyType.ID, 2, PropertyType.EMBEDDED_ID));
        Map<Object, Object> decoded = codec.decode(ImmutableMap.<Object, Object>of(3, 3, 4, 4));

        //Then
        assertThat(encoded.get(1)).isEqualTo(0);
        assertThat(encoded.get(2)).isEqualTo(1);
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.