Package org.qi4j.api.type

Examples of org.qi4j.api.type.ValueType


    @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 givenMapOfStringByteAndNullElementWhenSerializingAndDeserializingExpectEquals()
        throws Exception
    {
        String output = valueSerialization.serialize( stringByteMap() );
        MapType mapType = new MapType( Map.class, new ValueType( String.class ), new ValueType( Byte.class ) );
        Map<String, Byte> value = valueSerialization.deserialize( mapType, output );
        assertEquals( stringByteMap(), value );
    }
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

    @Test
    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

                if( propsPrefs == null )
                {
                    propsPrefs = entityPrefs.node( "properties" );
                }

                ValueType propertyType = persistentPropertyDescriptor.valueType();
                Class<?> mainType = propertyType.mainType();
                if( Number.class.isAssignableFrom( mainType ) )
                {
                    if( mainType.equals( Long.class ) )
                    {
                        properties.put( persistentPropertyDescriptor.qualifiedName(),
View Full Code Here

                {
                    propsPrefs.remove( persistentProperty.qualifiedName().name() );
                }
                else
                {
                    ValueType valueType = persistentProperty.valueType();
                    Class<?> mainType = valueType.mainType();
                    if( Number.class.isAssignableFrom( mainType ) )
                    {
                        if( mainType.equals( Long.class ) )
                        {
                            propsPrefs.putLong( persistentProperty.qualifiedName().name(), (Long) value );
View Full Code Here

        Object value = entity.getProperty( uri );
        if( value instanceof Text )
        {
            value = ( (Text) value ).getValue();
        }
        ValueType type = valueTypes.get( stateName );
        if( value != null && type != null )
        {
            try
            {
                value = valueSerialization.deserialize( type, value.toString() );
View Full Code Here

TOP

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

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.