Package org.qi4j.api.type

Examples of org.qi4j.api.type.CollectionType


    @Test
    public void givenCollectionTypeWithIntegerAndNullElementWhenSerializingAndDeserializingExpectEquals()
        throws Exception
    {
        String output = valueSerialization.serialize( integerCollection() );
        CollectionType collectionType = new CollectionType( List.class, new ValueType( Integer.class ) );
        List<Integer> list = valueSerialization.deserialize( collectionType, output );
        assertEquals( integerCollection(), list );
    }
View Full Code Here


    @Test
    public void givenCollectionTypeWithLongAndNullElementWhenSerializingAndDeserializingExpectEquals()
        throws Exception
    {
        String output = valueSerialization.serialize( longCollection() );
        CollectionType collectionType = new CollectionType( List.class, new ValueType( Long.class ) );
        List<Long> list = valueSerialization.deserialize( collectionType, output );
        assertEquals( longCollection(), list );
    }
View Full Code Here

    @Test
    public void givenCollectionTypeWithFloatAndNullElementWhenSerializingAndDeserializingExpectEquals()
        throws Exception
    {
        String output = valueSerialization.serialize( floatCollection() );
        CollectionType collectionType = new CollectionType( List.class, new ValueType( Float.class ) );
        List<Float> list = valueSerialization.deserialize( collectionType, output );
        assertEquals( floatCollection(), list );
    }
View Full Code Here

    @Test
    public void givenCollectionTypeWithDoubleAndNullElementWhenSerializingExpectCorrectJsonOutput()
        throws Exception
    {
        String output = valueSerialization.serialize( doubleCollection() );
        CollectionType collectionType = new CollectionType( List.class, new ValueType( Double.class ) );
        List<Double> list = valueSerialization.deserialize( collectionType, output );
        assertEquals( doubleCollection(), list );

    }
View Full Code Here

    @Test
    public void givenCollectionTypeWithBigIntegerAndNullElementWhenSerializingAndDeserializingExpectEquals()
        throws Exception
    {
        String output = valueSerialization.serialize( bigIntegerCollection() );
        CollectionType collectionType = new CollectionType( List.class, new ValueType( BigInteger.class ) );
        List<BigInteger> list = valueSerialization.deserialize( collectionType, output );
        assertEquals( bigIntegerCollection(), list );
    }
View Full Code Here

    @Test
    public void givenCollectionTypeWithBigDecimalAndNullElementWhenSerializingAndDeserializingExpectEquals()
        throws Exception
    {
        String output = valueSerialization.serialize( bigDecimalCollection() );
        CollectionType collectionType = new CollectionType( Collection.class, new ValueType( BigDecimal.class ) );
        Collection<BigDecimal> collection = valueSerialization.deserialize( collectionType, output );
        assertEquals( bigDecimalCollection(), collection );
    }
View Full Code Here

    @Test
    public void givenMapOfStringListStringAndNullElementWhenSerializingAndDeserializingExpectEquals()
        throws Exception
    {
        String output = valueSerialization.serialize( stringMultiMap() );
        CollectionType collectionType = new CollectionType( List.class, new ValueType( String.class ) );
        MapType mapType = new MapType( Map.class, new ValueType( String.class ), collectionType );
        Map<String, List<String>> value = valueSerialization.deserialize( mapType, output );
        assertEquals( stringMultiMap(), value );
    }
View Full Code Here

    public void givenListOfMapStringStringAndNullElementWhenSerializingAndDeserializingExpectEquals()
        throws Exception
    {
        String output = valueSerialization.serialize( stringListOfMaps() );
        ValueType stringType = new ValueType( String.class );
        CollectionType collectionType = new CollectionType( List.class, new MapType( Map.class, stringType, stringType ) );
        List<Map<String, String>> value = valueSerialization.deserialize( collectionType, output );
        assertEquals( stringListOfMaps(), value );
    }
View Full Code Here

    public void givenListOfValueCompositesAndNullElementWhenSerializingAndDeserializingExpectEquals()
        throws Exception
    {
        String output = valueSerialization.serialize( valueCompositesList() );
        ValueCompositeType valueType = module.valueDescriptor( SomeValue.class.getName() ).valueType();
        CollectionType collectionType = new CollectionType( List.class, valueType );
        List<SomeValue> value = valueSerialization.deserialize( collectionType, output );
        assertEquals( valueCompositesList(), value );
    }
View Full Code Here

    public <T> Function<String, T> deserialize( Class<T> type )
    {
        if( CollectionType.isCollection( type ) )
        {
            ValueType objectValueType = new ValueType( Object.class );
            return deserialize( new CollectionType( type, objectValueType ) );
        }
        if( MapType.isMap( type ) )
        {
            ValueType objectValueType = new ValueType( Object.class );
            return deserialize( new MapType( type, objectValueType, objectValueType ) );
View Full Code Here

TOP

Related Classes of org.qi4j.api.type.CollectionType

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.