Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonToken


  protected void skipToNextField() throws IOException {
    String fieldName = getCurrentName();

    notifySkippingField( fieldName );
    JsonToken token = super.nextToken();

    if ( token == JsonToken.START_OBJECT || token == JsonToken.START_ARRAY ) {
      notifySkippingValue(fieldName);
      skipChildren();
      super.nextToken();
View Full Code Here


  public boolean write(Reader reader, ComplexWriter writer) throws JsonParseException, IOException {

    parser = factory.createJsonParser(reader);
    reader.mark(1024*128);
    JsonToken t = parser.nextToken();
    while(!parser.hasCurrentToken()) t = parser.nextToken();


    switch (t) {
    case START_OBJECT:
View Full Code Here

  private void writeData(MapWriter map) throws JsonParseException, IOException {
    //
    map.start();
    outside: while(true){
      JsonToken t = parser.nextToken();
      if(t == JsonToken.NOT_AVAILABLE || t == JsonToken.END_OBJECT) return;

      assert t == JsonToken.FIELD_NAME : String.format("Expected FIELD_NAME but got %s.", t.name());
      final String fieldName = parser.getText();


      switch(parser.nextToken()){
      case START_ARRAY:
View Full Code Here

    private void init()
    {
      if (jp == null) {
        try {
          jp = objectMapper.getFactory().createParser(future.get());
          final JsonToken nextToken = jp.nextToken();
          if (nextToken == JsonToken.START_OBJECT) {
            QueryInterruptedException e = jp.getCodec().readValue(jp, QueryInterruptedException.class);
            throw e;
          } else if (nextToken != JsonToken.START_ARRAY) {
            throw new IAE("Next token wasn't a START_ARRAY, was[%s] from url [%s]", jp.getCurrentToken(), url);
View Full Code Here

      @Override
      public DateTime deserialize(JsonParser jp, DeserializationContext ctxt)
          throws IOException, JsonProcessingException
      {
          JsonToken t = jp.getCurrentToken();
          if (t == JsonToken.VALUE_NUMBER_INT) {
              return new DateTime(jp.getLongValue());
          }
          if (t == JsonToken.VALUE_STRING) {
              String str = jp.getText().trim();
View Full Code Here

    }

    @Override
    public Date deserialize(JsonParser jp, DeserializationContext ctxt)
            throws IOException {
        JsonToken token = jp.getCurrentToken();
        if (token == JsonToken.VALUE_EMBEDDED_OBJECT) {
            // See if it's a date
            Object date = jp.getEmbeddedObject();
            if (date instanceof Date) {
                return (Date) date;
View Full Code Here

            throws IOException, JsonProcessingException {
        // First of all, make sure that we can get a copy of the DBCollection
        if (jp instanceof JacksonDBCollectionProvider) {
            K id = null;
            String collectionName = null;
            JsonToken token = jp.getCurrentToken();
            if (token == JsonToken.VALUE_NULL) {
                return null;
            }
            if (token == JsonToken.VALUE_EMBEDDED_OBJECT) {
                // Someones already kindly decoded it for us
View Full Code Here

    }

    @Override
    public Calendar deserialize(JsonParser jp, DeserializationContext ctxt)
            throws IOException {
        JsonToken token = jp.getCurrentToken();
        Date date;
        if (token == JsonToken.VALUE_EMBEDDED_OBJECT) {
            // See if it's a date
            Object object = jp.getEmbeddedObject();
            if (object instanceof Date) {
View Full Code Here

                "Writing JSON nodes not supported");
    }

    @Override
    public void copyCurrentEvent(JsonParser jp) throws IOException {
        JsonToken t = jp.getCurrentToken();
        switch (t) {
            case START_OBJECT:
                writeStartObject();
                break;
            case END_OBJECT:
View Full Code Here

        }
    }

    @Override
    public void copyCurrentStructure(JsonParser jp) throws IOException {
        JsonToken t = jp.getCurrentToken();

        // Let'string handle field-name separately first
        if (t == JsonToken.FIELD_NAME) {
            writeFieldName(jp.getCurrentName());
            t = jp.nextToken();
View Full Code Here

TOP

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

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.