Package org.qi4j.api.type

Examples of org.qi4j.api.type.MapType


            if (value != null)
            {
                Map map = new LinkedHashMap( (Map) value);

                // Check if keys/values are Values
                MapType mapType = (MapType) propertyDescriptor.valueType();
                if( mapType.getKeyType() instanceof ValueCompositeType )
                {
                    for( Object instance : map.keySet() )
                    {
                        ValueInstance.getValueInstance( (ValueComposite) instance ).prepareToBuild();
                    }
                }
                if( mapType.getValueType() instanceof ValueCompositeType )
                {
                    for( Object instance : map.values() )
                    {
                        ValueInstance.getValueInstance( (ValueComposite) instance ).prepareToBuild();
                    }
View Full Code Here


        {
            T value = get();

            if (value != null)
            {
                MapType mapType = (MapType) propertyDescriptor.valueType();
                if( mapType.getKeyType() instanceof ValueCompositeType )
                {
                    Map map = (Map) value;
                    for( Object instance : map.keySet() )
                    {
                        ValueInstance.getValueInstance( (ValueComposite) instance ).prepareBuilderState();
                    }
                }
                if( mapType.getValueType() instanceof ValueCompositeType )
                {
                    Map map = (Map) value;
                    for( Object instance : map.values() )
                    {
                        ValueInstance.getValueInstance( (ValueComposite) instance ).prepareBuilderState();
View Full Code Here

                    TypeVariable valueTypeVariable = (TypeVariable) valType;
                    valType = Classes.resolveTypeVariable( valueTypeVariable, declaringClass, compositeType );
                }
                ValueType valuedType = newValueType( valType, declaringClass, compositeType, layer, module );

                valueType = new MapType( Classes.RAW_CLASS.map( type ), keyedType, valuedType );
            }
            else
            {
                valueType = new MapType( Classes.RAW_CLASS
                                             .map( type ), newValueType( Object.class, declaringClass, compositeType, layer, module ), newValueType( Object.class, declaringClass, compositeType, layer, module ) );
            }
        }
        else if( ValueCompositeType.isValueComposite( type ) )
        {
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

    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

            return deserialize( new CollectionType( type, objectValueType ) );
        }
        if( MapType.isMap( type ) )
        {
            ValueType objectValueType = new ValueType( Object.class );
            return deserialize( new MapType( type, objectValueType, objectValueType ) );
        }
        return deserialize( new ValueType( type ) );
    }
View Full Code Here

            return deserialize( new CollectionType( type, objectValueType ), input );
        }
        if( MapType.isMap( type ) )
        {
            ValueType objectValueType = new ValueType( Object.class );
            return deserialize( new MapType( type, objectValueType, objectValueType ), input );
        }
        return deserialize( new ValueType( type ), input );
    }
View Full Code Here

            return deserialize( new CollectionType( type, objectValueType ), input );
        }
        if( MapType.isMap( type ) )
        {
            ValueType objectValueType = new ValueType( Object.class );
            return deserialize( new MapType( type, objectValueType, objectValueType ), input );
        }
        return deserialize( new ValueType( type ), input );
    }
View Full Code Here

            if( value != null )
            {
                Map map = new LinkedHashMap( (Map) value );

                // Check if keys/values are Values
                MapType mapType = (MapType) propertyDescriptor.valueType();
                if( mapType.keyType() instanceof ValueCompositeType )
                {
                    for( Object instance : map.keySet() )
                    {
                        ValueInstance.valueInstanceOf( (ValueComposite) instance ).prepareToBuild();
                    }
                }
                if( mapType.valueType() instanceof ValueCompositeType )
                {
                    for( Object instance : map.values() )
                    {
                        ValueInstance.valueInstanceOf( (ValueComposite) instance ).prepareToBuild();
                    }
View Full Code Here

TOP

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

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.