Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonParser


    private DocumentSource createDocumentSource() {
        final InputStream inputStream = _resource.read();
        try {
            final MappingJsonFactory jsonFactory = new MappingJsonFactory();
            final JsonParser parser = jsonFactory.createParser(inputStream);
            logger.debug("Created JSON parser for resource: {}", _resource);

            return new JsonDocumentSource(parser, _resource.getName());
        } catch (Exception e) {
            FileHelper.safeClose(inputStream);
View Full Code Here


                throws IOException {

            ObjectNode root = jp.readValueAsTree();

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

            // 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");
            }

            return subJsonParser.readValueAs( RealFilter5.class );
        }
View Full Code Here

                throws IOException {

            ObjectNode root = jp.readValueAsTree();

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

            // 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() ) {
                return subJsonParser.readValueAs( StringRealFilter4.class );
            }
            else if ( valueParam.isIntegralNumber() ) {
                return subJsonParser.readValueAs( IntegerRealFilter4.class );
            }
            else {
                throw new RuntimeException("Unknown type");
            }
        }
View Full Code Here

            JsonNode queryParam = root.get("queryParam");
            String value = queryParam.asText();

            // 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

            if ( arrayNode == null || arrayNode.isMissingNode() || ! arrayNode.isArray() ) {
                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<QueryFilter4> childrenQueryFilters = subJsonParser.readValueAs( new TypeReference<List<QueryFilter4>>() {} );

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

                throws IOException {

            ObjectNode root = jp.readValueAsTree();

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

            // Check if it is a "RealFilter"
            JsonNode queryParam = root.get("queryParam");
            if ( queryParam != null && queryParam.isValueNode() ) {
                return subJsonParser.readValueAs( RealFilter.class );
            }
            else {
                return subJsonParser.readValueAs( LogicalFilter3.class );
            }
        }
View Full Code Here

            if ( arrayNode == null || arrayNode.isMissingNode() || ! arrayNode.isArray() ) {
                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 LogicalFilter3( QueryParam.valueOf( key ), childrenQueryFilters );
        }
View Full Code Here

    }

    private JsonNode getResponseTree( Response response )
        throws IOException
    {
        JsonParser jsonParser = jsonFactory.createJsonParser( (InputStream) response.getEntity() );
        return (JsonNode) jsonParser.readValueAsTree();
    }
View Full Code Here

    }

    private JsonNode getResponseTree( Response response )
        throws IOException
    {
        JsonParser jsonParser = jsonFactory.createJsonParser( (InputStream) response.getEntity() );
        return (JsonNode) jsonParser.readValueAsTree();
    }
View Full Code Here

  @Nonnull
  public T deserialize( @Nonnull InputStream in, @Nullable Version version ) throws IOException, VersionException {
    try {
      JsonFactory jsonFactory = JacksonSupport.getJsonFactory();
      JsonParser parser = createJsonParser( jsonFactory, in );

      T deserialized = deserializeInternal( parser, version );

      JacksonParserWrapper parserWrapper = new JacksonParserWrapper( parser );
      if ( parserWrapper.nextToken() != null ) {
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.core.JsonParser

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.