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

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


        Class<V> valueClass;
        Type genericType = field.getGenericType();

        valueClass = TypeParser.inferValueClassForListOrSet(genericType, entityClass);
        Method[] accessors = entityIntrospector.findAccessors(entityClass, field);
        final SetCodec setCodec = codecFactory.parseSetField(context);
        final Class<?> cql3ValueType = codecFactory.determineCQL3ValueType(setCodec, timeUUID);

        PropertyType type = SET;

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


    }

  @Test
  public void should_build_set() throws Exception {

        SetCodec setCodec = mock(SetCodec.class);

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

        }

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

        //When
        final SetCodec codec = factory.parseSetField(createContext(field));
        final Set<Object> encoded = codec.encode(Sets.newSet(PropertyType.ID, PropertyType.EMBEDDED_ID));
        final Set<Object> decoded = codec.decode(Sets.newSet(2, 3, 4));

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

            private Set<Long> counts;
        }

        Field field = Test.class.getDeclaredField("counts");
        //When
        final SetCodec codec = factory.parseSetField(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_set_type() throws Exception {
        //Given
        SetCodec setCodec = mock(SetCodec.class);
        when(setCodec.sourceType()).thenReturn(Integer.class);
        when(setCodec.targetType()).thenReturn(String.class);

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

        //Then
View Full Code Here

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

        //When
        final SetCodec actual = parser.parseAndValidateSetCodec(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.SetCodec

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.