Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonParser.readValueAs()


            if ( queryParam != null && queryParam.isValueNode() ) {

                // pass in our objectCodec so that the subJsonParser knows about our configured Modules and Annotations
                JsonParser subJsonParser = root.traverse( objectCodec );

                return subJsonParser.readValueAs( RealFilter.class );
            }

            // We assume it is a LogicalFilter
            Iterator<String> iter = root.fieldNames();
            String key = iter.next();
View Full Code Here


                throw new RuntimeException( "Invalid format of LogicalFilter encountered." );
            }

            // pass in our objectCodec so that the subJsonParser knows about our configured Modules and Annotations
            JsonParser subJsonParser = arrayNode.traverse( objectCodec );
            List<QueryFilter> childrenQueryFilters = subJsonParser.readValueAs( new TypeReference<List<QueryFilter>>() {} );

            return new LogicalFilter2( QueryParam.valueOf( key ), childrenQueryFilters );
        }
    }
View Full Code Here

            // Check if it is a "RealFilter"
            JsonNode valuesParam = root.get("values");

            if ( valuesParam == null ) {
                 return subJsonParser.readValueAs( LogicalFilter5.class );
            }
            if ( ! valuesParam.isArray() ) {
               throw new RuntimeException( "Expected an Array");
            }
View Full Code Here

            }
            if ( ! valuesParam.isArray() ) {
               throw new RuntimeException( "Expected an Array");
            }

            return subJsonParser.readValueAs( RealFilter5.class );
        }
    }

    @Test
    public void testPolymorphicJacksonSerializationAndDeserialization()
View Full Code Here

            // Check if it is a "RealFilter"
            JsonNode valueParam = root.get("value");

            if ( valueParam == null ) {
                 return subJsonParser.readValueAs( LogicalFilter4.class );
            }
            if ( valueParam.isBoolean() ) {
                return subJsonParser.readValueAs( BooleanRealFilter4.class );
            }
            else if ( valueParam.isTextual() ) {
View Full Code Here

            if ( valueParam == null ) {
                 return subJsonParser.readValueAs( LogicalFilter4.class );
            }
            if ( valueParam.isBoolean() ) {
                return subJsonParser.readValueAs( BooleanRealFilter4.class );
            }
            else if ( valueParam.isTextual() ) {
                return subJsonParser.readValueAs( StringRealFilter4.class );
            }
            else if ( valueParam.isIntegralNumber() ) {
View Full Code Here

            }
            if ( valueParam.isBoolean() ) {
                return subJsonParser.readValueAs( BooleanRealFilter4.class );
            }
            else if ( valueParam.isTextual() ) {
                return subJsonParser.readValueAs( StringRealFilter4.class );
            }
            else if ( valueParam.isIntegralNumber() ) {
                return subJsonParser.readValueAs( IntegerRealFilter4.class );
            }
            else {
View Full Code Here

            }
            else if ( valueParam.isTextual() ) {
                return subJsonParser.readValueAs( StringRealFilter4.class );
            }
            else if ( valueParam.isIntegralNumber() ) {
                return subJsonParser.readValueAs( IntegerRealFilter4.class );
            }
            else {
                throw new RuntimeException("Unknown type");
            }
        }
View Full Code Here

            // pass in our objectCodec so that the subJsonParser knows about our configured Modules and Annotations
            JsonParser subJsonParser = root.traverse( jp.getCodec() );

            // Determine the "type" of filter we are dealing with Real or Logical and specify type
            if ( "OR".equals( value ) || "AND".equals( value ) ) {
                return subJsonParser.readValueAs( LogicalFilter1.class );
            }
            else {
                return subJsonParser.readValueAs( RealFilter.class );
            }
        }
View Full Code Here

            // Determine the "type" of filter we are dealing with Real or Logical and specify type
            if ( "OR".equals( value ) || "AND".equals( value ) ) {
                return subJsonParser.readValueAs( LogicalFilter1.class );
            }
            else {
                return subJsonParser.readValueAs( RealFilter.class );
            }
        }
    }

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