Package org.qi4j.api.type

Examples of org.qi4j.api.type.CollectionType


    @Test
    public void givenJsonOfBigIntegerCollectionWithQuotesWhenDeserializingExpectCorrectValueOutput()
        throws Exception
    {
        ValueType collectedType = new ValueType( BigInteger.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );
        Object json = new JSONArray( bigIntegerJsonWithQuotes() );
        List<BigDecimal> result = (List<BigDecimal>) new JSONDeserializer( null ).deserialize( json, collectionType );
        assertEquals( bigIntegerCollection(), result );
    }
View Full Code Here


    @Test
    public void givenJsonOfBigDecimalCollectionWithQuotesWhenDeserializingExpectCorrectValueOutput()
        throws Exception
    {
        ValueType collectedType = new ValueType( BigDecimal.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );
        Object json = new JSONArray( bigDecimalJsonWithQuotes() );
        List<BigDecimal> result = (List<BigDecimal>) new JSONDeserializer( null ).deserialize( json, collectionType );
        assertEquals( bigDecimalCollection(), result );
    }
View Full Code Here

                {
                    TypeVariable collectionTypeVariable = (TypeVariable) collectionType;
                    collectionType = Classes.resolveTypeVariable( collectionTypeVariable, declaringClass, compositeType );
                }
                ValueType collectedType = newValueType( collectionType, declaringClass, compositeType, layer, module );
                valueType = new CollectionType( Classes.RAW_CLASS.map( type ), collectedType );
            }
            else
            {
                valueType = new CollectionType( Classes.RAW_CLASS
                                                    .map( type ), newValueType( Object.class, declaringClass, compositeType, layer, module ) );
            }
        }
        else if( MapType.isMap( type ) )
        {
View Full Code Here

    @Test
    public void givenISO6801DateFormatWhenConvertingFromSerializedStateExpectValidDate()
        throws Exception
    {
        CollectionType collectionType = new CollectionType( List.class, dateType );
        List<Date> value = valueDeserializer.deserialize( collectionType, "[\"2009-08-12T14:54:27.895+0800\"]" );
        assertEquals( new DateTime( "2009-08-12T06:54:27.895Z", DateTimeZone.UTC ).toDate(), value.get( 0 ) );
    }
View Full Code Here

    @Test
    public void givenAtDateFormatWhenConvertingFromSerializedStateExpectValidDate()
        throws Exception
    {
        long tstamp = System.currentTimeMillis();
        CollectionType collectionType = new CollectionType( List.class, dateType );
        List<Date> value = valueDeserializer.deserialize( collectionType, "[\"@" + tstamp + "@\"]" );
        assertEquals( new Date( tstamp ), value.get( 0 ) );
    }
View Full Code Here

    @Test
    public void givenMicrosoftDateFormatWhenConvertingFromSerializedStateExpectValidDate()
        throws Exception
    {
        long tstamp = System.currentTimeMillis();
        CollectionType collectionType = new CollectionType( List.class, dateType );
        List<Date> value = valueDeserializer.deserialize( collectionType, "[\"/Date(" + tstamp + ")/\"]" );
        assertEquals( new Date( tstamp ), value.get( 0 ) );
    }
View Full Code Here

    @Test
    public void givenIterableTypeWithByteAndNullElementWhenSerializingAndDeserializingExpectEquals()
        throws Exception
    {
        String output = valueSerialization.serialize( Iterables.iterable( byteCollection().toArray() ) );
        CollectionType collectionType = new CollectionType( List.class, new ValueType( Byte.class ) );
        List<Byte> list = valueSerialization.deserialize( collectionType, output );
        assertEquals( byteCollection(), list );
    }
View Full Code Here

    @Test
    public void givenCollectionTypeWithByteAndNullElementWhenSerializingAndDeserializingExpectEquals()
        throws Exception
    {
        String output = valueSerialization.serialize( byteCollection() );
        CollectionType collectionType = new CollectionType( Set.class, new ValueType( Byte.class ) );
        Set<Byte> list = valueSerialization.deserialize( collectionType, output );
        assertEquals( new LinkedHashSet<Byte>( byteCollection() ), list );
    }
View Full Code Here

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

    @Test
    public void givenCollectionTypeWithShortAndNullElementWhenSerializingAndDeserializingExpectEquals()
        throws Exception
    {
        String output = valueSerialization.serialize( shortCollection() );
        CollectionType collectionType = new CollectionType( List.class, new ValueType( Short.class ) );
        List<Short> list = valueSerialization.deserialize( collectionType, output );
        assertEquals( shortCollection(), list );
    }
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.