Examples of JsonDeserializer


Examples of org.neo4j.smack.serialization.JsonDeserializer

    @Test
    public void testReadingMap() throws Exception {
        InputStream in = new ByteArrayInputStream("{\"firstkey\":1,\"secondkey\":2}".getBytes("UTF-8"));
       
        JsonDeserializer d = new JsonDeserializer(new JsonFactory(new ObjectMapper()), in);
       
        Map<String,Object> deserialized = d.readMap();
       
        assertThat(deserialized.containsKey("firstkey"), is(true));
        assertThat(deserialized.containsKey("secondkey"), is(true));
       
        assertThat((Integer)deserialized.get("firstkey"), is(1));
View Full Code Here

Examples of org.neo4j.smack.serialization.JsonDeserializer

   
    public <T> T deserialize(byte[] bytes,
            DeserializationStrategy<T> strategy)
    {
        InputStream in = new ByteArrayInputStream(bytes);
        JsonDeserializer deserializer = new JsonDeserializer(jsonFactory, in);
        return strategy.deserialize(deserializer);
    }
View Full Code Here

Examples of org.qi4j.api.json.JSONDeserializer

        throws Exception
    {
        ValueType collectedType = new ValueType( Byte.class );
        CollectionType collectionType = new CollectionType( List.class, collectedType );
        Object json = new JSONArray( byteJson() );
        List<Byte> result = (List<Byte>) new JSONDeserializer( null ).deserialize( json, collectionType );
        ArrayList<Byte> bytes = byteCollection();
        for( int i = 0; i < result.size(); i++ )
        {
            Byte resultByte = result.get( i );
            if( resultByte != null )
View Full Code Here

Examples of org.qi4j.api.json.JSONDeserializer

        throws Exception
    {
        ValueType collectedType = new ValueType( Byte.class );
        CollectionType collectionType = new CollectionType( Set.class, collectedType );
        Object json = new JSONArray( byteJson() );
        Set<Byte> result = (Set<Byte>) new JSONDeserializer( null ).deserialize( json, collectionType );
        Set<Byte> bytes = new LinkedHashSet<Byte>( byteCollection() );
        assertEquals( bytes, result );
    }
View Full Code Here

Examples of org.qi4j.api.json.JSONDeserializer

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

Examples of org.qi4j.api.json.JSONDeserializer

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

Examples of org.qi4j.api.json.JSONDeserializer

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

Examples of org.qi4j.api.json.JSONDeserializer

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

Examples of org.qi4j.api.json.JSONDeserializer

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

Examples of org.qi4j.api.json.JSONDeserializer

        throws Exception
    {
        ValueType collectedType = new ValueType( Double.class );
        CollectionType collectionType = new CollectionType( Collection.class, collectedType );
        Object json = new JSONArray( doubleJson() );
        List<Double> result = (List<Double>) new JSONDeserializer( null ).deserialize( json, collectionType );
        assertEquals( doubleCollection(), result );
    }
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.