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

Examples of info.archinnov.achilles.internal.metadata.codec.ListCodec


        Class<V> valueClass;
        Type genericType = field.getGenericType();
        valueClass = TypeParser.inferValueClassForListOrSet(genericType, entityClass);

        Method[] accessors = entityIntrospector.findAccessors(entityClass, field);
        final ListCodec listCodec = codecFactory.parseListField(context);
        final Class<?> cql3ValueType = codecFactory.determineCQL3ValueType(listCodec, timeUUID);

        PropertyType type = LIST;

        PropertyMeta listMeta = factory().objectMapper(context.getCurrentObjectMapper()).type(type)
View Full Code Here


    }

  @Test
  public void should_build_list_with_default_empty_when_null() throws Exception {

        ListCodec listCodec = mock(ListCodec.class);

        PropertyMeta built = PropertyMetaBuilder.factory()
                .type(LIST)
                .propertyName("prop")
                .accessors(accessors)
View Full Code Here

        }

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

        //When
        final ListCodec codec = factory.parseListField(createContext(field));
        final List<Object> encoded = codec.encode(Arrays.<Object>asList(PropertyType.ID, PropertyType.EMBEDDED_ID));
        final List<Object> decoded = codec.decode(Arrays.<Object>asList(2, 3, 4));

        //Then
        assertThat(encoded).containsExactly(0, 1);
        assertThat(decoded).containsExactly(PropertyType.SIMPLE, PropertyType.LIST, PropertyType.SET);
    }
View Full Code Here

            private List<Long> counts;
        }

        Field field = Test.class.getDeclaredField("counts");
        //When
        final ListCodec codec = factory.parseListField(createContext(field));

        //Then
        assertThat(codec.sourceType()).isSameAs(Long.class);
        assertThat(codec.targetType()).isSameAs(String.class);
    }
View Full Code Here


    @Test
    public void should_determine_cql3_list_type() throws Exception {
        //Given
        ListCodec listCodec = mock(ListCodec.class);
        when(listCodec.sourceType()).thenReturn(Integer.class);
        when(listCodec.targetType()).thenReturn(String.class);

        //When
        final Class<?> actualClass = factory.determineCQL3ValueType(listCodec, false);

        //Then
View Full Code Here

            @TypeTransformer(valueCodecClass = LongToStringCodec.class)
            private List<Long> longToString;
        }

        //When
        final ListCodec actual = parser.parseAndValidateListCodec(Test.class.getDeclaredField("longToString"));

        //Then
        assertThat(actual.sourceType()).isSameAs(Long.class);
        assertThat(actual.targetType()).isSameAs(String.class);
    }
View Full Code Here

TOP

Related Classes of info.archinnov.achilles.internal.metadata.codec.ListCodec

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.