Examples of JsonToken


Examples of com.fasterxml.jackson.core.JsonToken

 
 
  @SuppressWarnings("unchecked")
  public T jsonRead(JsonParser parser, String path) throws IOException {
   
    JsonToken token = parser.nextToken();
    if (JsonToken.VALUE_NULL == token || JsonToken.END_ARRAY == token) {
      return null;
    }
    if (JsonToken.START_OBJECT != token) {
      throw new JsonParseException("Unexpected token "+token+" - expecting start_object", parser.getCurrentLocation());
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonToken

  @SuppressWarnings("unchecked")
  protected T jsonReadProperties(JsonParser parser, EntityBean bean) throws IOException {

    do {
    
      JsonToken event = parser.nextToken();
      if (JsonToken.FIELD_NAME == event) {
        String key = parser.getCurrentName();
        BeanProperty p = desc.getBeanProperty(key);
        if (p != null) {
          p.jsonRead(parser, bean);
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonToken

   
    if (!this.many.jsonDeserialize) {
      return;
    }

    JsonToken event = parser.nextToken();
    if (JsonToken.VALUE_NULL == event) {
      return;
    }
    if (JsonToken.START_ARRAY != event) {
      throw new JsonParseException("Unexpected token " + event + " - expecting start_array ", parser.getCurrentLocation());
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonToken

            super(BodyDTO.class);
        }

        @Override
        public BodyDTO deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException {
            JsonToken currentToken = jsonParser.getCurrentToken();
            if (currentToken == JsonToken.START_OBJECT) {
                jsonParser.nextToken();
                if (jsonParser.getCurrentToken() == JsonToken.FIELD_NAME && jsonParser.getText().equals("type")) {
                    jsonParser.nextToken();
                    if (jsonParser.getCurrentToken() == JsonToken.VALUE_STRING) {
                        Body.Type type = Body.Type.valueOf(jsonParser.getText());
                        jsonParser.nextToken();
                        switch (type) {
                            case STRING:
                            case REGEX:
                            case JSON:
                            case XPATH:
                                if (jsonParser.getCurrentToken() == JsonToken.FIELD_NAME && jsonParser.getText().equals("value")) {
                                    jsonParser.nextToken();
                                    if (jsonParser.getCurrentToken() == JsonToken.VALUE_STRING) {
                                        String value = jsonParser.getText();
                                        jsonParser.nextToken();
                                        if (jsonParser.getCurrentToken() == JsonToken.END_OBJECT) {
                                            return new StringBodyDTO(new StringBody(value, type));
                                        }
                                    }
                                }
                                break;
                            case BINARY:
                                if (jsonParser.getCurrentToken() == JsonToken.FIELD_NAME && jsonParser.getText().equals("value")) {
                                    jsonParser.nextToken();
                                    if (jsonParser.getCurrentToken() == JsonToken.VALUE_STRING) {
                                        String value = jsonParser.getText();
                                        jsonParser.nextToken();
                                        if (jsonParser.getCurrentToken() == JsonToken.END_OBJECT) {
                                            return new BinaryBodyDTO(new BinaryBody(Base64Converter.base64StringToBytes(value)));
                                        }
                                    }
                                }
                                break;
                            case PARAMETERS:
                                if (jsonParser.getCurrentToken() == JsonToken.FIELD_NAME && jsonParser.getText().equals("parameters")) {
                                    jsonParser.nextToken();
                                    if (jsonParser.isExpectedStartArrayToken()) {
                                        List<Parameter> parameters = new ArrayList<Parameter>();
                                        boolean inObject = false;
                                        while (inObject || jsonParser.getCurrentToken() != JsonToken.END_ARRAY) {
                                            JsonToken token = jsonParser.nextToken();
                                            switch (token) {
                                                case START_OBJECT:
                                                    inObject = true;
                                                    break;
                                                case END_OBJECT:
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonToken

  private Map<String,Object> parseHstore(String json) throws IOException {
    JsonParser parser = jsonFactory.createParser(json);
    // BeanProperty reads the first token checking for null so
    // simulate that here
    JsonToken token = parser.nextToken();
    assertEquals(JsonToken.START_OBJECT, token);
    return (Map<String,Object>)hstore.jsonRead(parser, token);
  }
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonToken

  public void jsonRead(JsonParser ctx, EntityBean bean) throws IOException {
    if (!jsonDeserialize) {
      return;
    }

    JsonToken event = ctx.nextToken();
    if (JsonToken.VALUE_NULL == event) {
      setValue(bean, null);
    } else {
      // expect to read non-null json value
      Object objValue = scalarType.jsonRead(ctx, event);
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonToken

    @Override
    public final void deserializeAndSet(JsonParser jp, DeserializationContext ctxt,
            Object instance)
        throws IOException, JsonProcessingException
    {
        JsonToken t = jp.getCurrentToken();
        if (t == JsonToken.VALUE_NULL) {
            /* Hmmh. Is this a problem? We won't be setting anything, so it's
             * equivalent of empty Collection/Map in this case
             */
            return;
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonToken

            return handleNonArray(jp, ctxt, new ArrayBlockingQueue<Object>(1));
        }
        ArrayList<Object> tmp = new ArrayList<Object>();
       
        JsonDeserializer<Object> valueDes = _valueDeserializer;
        JsonToken t;
        final TypeDeserializer typeDeser = _valueTypeDeserializer;

        while ((t = jp.nextToken()) != JsonToken.END_ARRAY) {
            Object value;
           
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonToken

        _sourceCollectionName = sourceCollectionName;
    }

    public Document next() {
        while (true) {
            final JsonToken token = getNextToken();
            if (token == null) {
                return null;
            }

            if (token == JsonToken.START_OBJECT) {
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonToken

       
        int originalDepth = context.getCurrentDepth();
        String currentParentElement = context.getCurrentParentElement();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.currentToken;
        if (token == null) token = context.nextToken();
        if (token == VALUE_NULL) return null;

        while (true) {
            if (token == null) break;
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.