Package org.qi4j.api.value

Examples of org.qi4j.api.value.ValueSerializationException


        throws Exception
    {
        JsonNode jsonNode = input.readValueAsTree();
        if( jsonNode.isArray() || jsonNode.isObject() )
        {
            throw new ValueSerializationException( "Asked for a Value but found an Object or an Array at "
                                                   + input.getCurrentLocation().toString() );
        }
        if( jsonNode.isDouble() )
        {
            return jsonNode.asDouble();
View Full Code Here


        {
            return null;
        }
        if( token != JsonToken.START_ARRAY )
        {
            throw new ValueSerializationException( "Expected an array start at "
                                                   + input.getCurrentLocation().toString() );
        }
        while( input.nextToken() != JsonToken.END_ARRAY )
        {
            T element = deserializer.map( input );
View Full Code Here

        {
            return null;
        }
        if( token != JsonToken.START_ARRAY )
        {
            throw new ValueSerializationException( "Expected an array start at "
                                                   + input.getCurrentLocation().toString() );
        }
        JsonToken currentToken = input.nextToken();
        while( currentToken != JsonToken.END_ARRAY )
        {
            if( currentToken != JsonToken.START_OBJECT )
            {
                throw new ValueSerializationException( "Expected an object start at "
                                                       + input.getCurrentLocation().toString() );
            }
            currentToken = input.nextToken();
            K key = null;
            V value = null;
View Full Code Here

        {
            token = input.nextToken();
        }
        if( token != JsonToken.START_OBJECT )
        {
            throw new ValueSerializationException( "Expected an object start at "
                                                   + input.getCurrentLocation().toString() );
        }
        return (ObjectNode) input.readValueAsTree();
    }
View Full Code Here

        {
            return null;
        }
        if( !inputNode.isValueNode() )
        {
            throw new ValueSerializationException( "Expected a value node but got a container node " + inputNode );
        }
        if( inputNode.isDouble() )
        {
            return inputNode.asDouble();
        }
View Full Code Here

        {
            return false;
        }
        if( !inputNode.isObject() )
        {
            throw new ValueSerializationException( "Expected an object but got " + inputNode );
        }
        return inputNode.has( key );
    }
View Full Code Here

        {
            return;
        }
        if( !inputNode.isArray() )
        {
            throw new ValueSerializationException( "Expected an array but got " + inputNode );
        }
        ArrayNode array = (ArrayNode) inputNode;
        for( JsonNode item : array )
        {
            T value = deserializer.map( item );
View Full Code Here

        {
            return;
        }
        if( !inputNode.isArray() )
        {
            throw new ValueSerializationException( "Expected an array but got " + inputNode );
        }
        ArrayNode array = (ArrayNode) inputNode;
        for( JsonNode item : array )
        {
            if( !item.isObject() )
            {
                throw new ValueSerializationException( "Expected an object but got " + inputNode );
            }
            JsonNode keyNode = item.get( "key" );
            JsonNode valueNode = item.get( "value" );
            K key = keyDeserializer.map( keyNode );
            V value = valueDeserializer.map( valueNode );
View Full Code Here

            input.nextTag();
            return null;
        }
        if( nextEvent.getEventType() != XMLEvent.CHARACTERS )
        {
            throw new ValueSerializationException( "Expected characters but got: " + nextEvent );
        }
        String stringValue = nextEvent.asCharacters().getData();
        return detectAndConvertStringValue( stringValue );
    }
View Full Code Here

            input.nextTag();
            return null;
        }
        if( !nextTag.isStartElement() || !"array".equals( nextTag.asStartElement().getName().getLocalPart() ) )
        {
            throw new ValueSerializationException( "Expected an <array/> but got: " + nextTag );
        }
        WHILE:
        while( input.hasNext() )
        {
            XMLEvent currentTag = input.nextTag();
            if( currentTag.isEndElement() )
            {
                String endElementName = currentTag.asEndElement().getName().getLocalPart();
                switch( endElementName )
                {
                    case "array":
                        break WHILE;
                    case "value":
                        continue;
                }
            }
            if( !"value".equals( currentTag.asStartElement().getName().getLocalPart() ) )
            {
                throw new ValueSerializationException( "Expected a <value/> but got: " + currentTag );
            }
            T item = deserializer.map( input );
            collection.add( item );
        }
        return collection;
View Full Code Here

TOP

Related Classes of org.qi4j.api.value.ValueSerializationException

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.