Examples of JSONDeserializer


Examples of org.qi4j.api.json.JSONDeserializer

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

Examples of org.qi4j.api.json.JSONDeserializer

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

Examples of org.qi4j.api.json.JSONDeserializer

        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

Examples of org.qi4j.api.json.JSONDeserializer

        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

Examples of org.qi4j.api.json.JSONDeserializer

    @Test
    public void givenLocalDateTypeWhenConvertingFromJsonExpectValidLocalDate()
        throws Exception
    {
        Object value = new JSONDeserializer( null ).deserialize( "2020-03-04", underTest );
        assertEquals( new LocalDate("2020-03-04"), value);
    }
View Full Code Here

Examples of org.qi4j.api.json.JSONDeserializer

    @Test
    public void givenLocalDateTypeWhenConvertingFromJsonExpectValidLocalDate()
        throws Exception
    {
        Object value = new JSONDeserializer( null ).deserialize( "2020-03-04T12:23:09", underTest );
        assertEquals( new LocalDateTime("2020-03-04T12:23:09", DateTimeZone.UTC ), value);
    }
View Full Code Here

Examples of org.qi4j.api.json.JSONDeserializer

    @Test
    public void givenLocalDateTypeWhenConvertingFromJsonExpectValidLocalDate()
        throws Exception
    {
        Object value = new JSONDeserializer( null ).deserialize( "2020-03-04T12:23:33Z", underTest );
        assertEquals( new DateTime("2020-03-04T12:23:33Z", DateTimeZone.UTC ), value);
    }
View Full Code Here

Examples of org.qi4j.api.json.JSONDeserializer

        {
            JSONObjectSerializer serializer = new JSONObjectSerializer();
            serializer.serialize( prototype, model.model().valueType() );
            Object object = serializer.getRoot();

            JSONDeserializer deserializer = new JSONDeserializer( model.module() );
            value = deserializer.deserialize( object, model.model().valueType() );
        } catch( JSONException e )
        {
            throw new IllegalStateException( "Could not JSON-copy Value", e );
        }
View Full Code Here

Examples of org.qi4j.api.json.JSONDeserializer

            throw new NoSuchValueException( mixinType.getName(), name() );
        }

        try
        {
            return (T) new JSONDeserializer( model.module() ).deserialize( new JSONTokener( jsonValue ).nextValue(), model.model().valueType() );
        } catch( JSONException e )
        {
            throw new ConstructionException( "Could not create value from JSON", e );
        }
    }
View Full Code Here

Examples of org.qi4j.api.json.JSONDeserializer

                PropertyDescriptor descriptor = entityDescriptor.state().getPropertyByQualifiedName( stateName );

                if (descriptor == null)
                    return null;

                JSONDeserializer deserializer = new JSONDeserializer( module );

                return deserializer.deserialize( json, descriptor.valueType() );
            }
        }
        catch( JSONException e )
        {
            throw new EntityStoreException( e );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.