Package com.alibaba.fastjson.parser

Examples of com.alibaba.fastjson.parser.JSONScanner.nextTokenWithColon()


    }
   
    public void test_next_11() throws Exception {
        String text = "\n\r\t\f\b :{";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextTokenWithColon(JSONToken.LBRACKET);
        Assert.assertEquals(JSONToken.LBRACE, lexer.token());
    }
   
    public void test_next_12() throws Exception {
        String text = "\n\r\t\f\b :";
View Full Code Here


    }
   
    public void test_next_12() throws Exception {
        String text = "\n\r\t\f\b :";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextTokenWithColon(JSONToken.LBRACKET);
        Assert.assertEquals(JSONToken.EOF, lexer.token());
    }
    public void test_next_13() throws Exception {
        String text = "\n\r\t\f\b :\n\r\t\f\b ";
        JSONScanner lexer = new JSONScanner(text);
View Full Code Here

        Assert.assertEquals(JSONToken.EOF, lexer.token());
    }
    public void test_next_13() throws Exception {
        String text = "\n\r\t\f\b :\n\r\t\f\b ";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextTokenWithColon(JSONToken.LBRACKET);
        Assert.assertEquals(JSONToken.EOF, lexer.token());
    }
}
View Full Code Here

        }

        if (lexer.token() == JSONToken.LITERAL_STRING && lexer.isRef()) {
          Object object = null;

          lexer.nextTokenWithColon(JSONToken.LITERAL_STRING);
          if (lexer.token() == JSONToken.LITERAL_STRING) {
            String ref = lexer.stringVal();
            if ("@".equals(ref)) {
              object = context.getObject();
            } else if ("..".equals(ref)) {
View Full Code Here

        }

        if (map.size() == 0 //
            && lexer.token() == JSONToken.LITERAL_STRING //
            && JSON.DEFAULT_TYPE_KEY.equals(lexer.stringVal())) {
          lexer.nextTokenWithColon(JSONToken.LITERAL_STRING);
          lexer.nextToken(JSONToken.COMMA);
          lexer.nextToken(keyDeserializer.getFastMatchToken());
        }

        Object key = keyDeserializer.deserialze(parser, keyType, null);
View Full Code Here

        if (!parser.isEnabled(Feature.IgnoreNotMatch)) {
          throw new JSONException("setter not found, class "
              + clazz.getName() + ", property " + key);
        }

        lexer.nextTokenWithColon();
        parser.parse(); // skip

        if (lexer.token() == JSONToken.RBRACE) {
          lexer.nextToken();
          return;
View Full Code Here

      } else {
        Method method = fieldDeser.getMethod();
        Class<?> fieldClass = method.getParameterTypes()[0];
        Type fieldType = method.getGenericParameterTypes()[0];
        if (fieldClass == int.class) {
          lexer.nextTokenWithColon(JSONToken.LITERAL_INT);
          args[0] = IntegerDeserializer.deserialze(parser);
        } else if (fieldClass == String.class) {
          lexer.nextTokenWithColon(JSONToken.LITERAL_STRING);
          args[0] = StringDeserializer.deserialze(parser);
        } else if (fieldClass == long.class) {
View Full Code Here

        Type fieldType = method.getGenericParameterTypes()[0];
        if (fieldClass == int.class) {
          lexer.nextTokenWithColon(JSONToken.LITERAL_INT);
          args[0] = IntegerDeserializer.deserialze(parser);
        } else if (fieldClass == String.class) {
          lexer.nextTokenWithColon(JSONToken.LITERAL_STRING);
          args[0] = StringDeserializer.deserialze(parser);
        } else if (fieldClass == long.class) {
          lexer.nextTokenWithColon(JSONToken.LITERAL_INT);
          args[0] = LongDeserializer.deserialze(parser);
        } else if (fieldClass == List.class) {
View Full Code Here

          args[0] = IntegerDeserializer.deserialze(parser);
        } else if (fieldClass == String.class) {
          lexer.nextTokenWithColon(JSONToken.LITERAL_STRING);
          args[0] = StringDeserializer.deserialze(parser);
        } else if (fieldClass == long.class) {
          lexer.nextTokenWithColon(JSONToken.LITERAL_INT);
          args[0] = LongDeserializer.deserialze(parser);
        } else if (fieldClass == List.class) {
          lexer.nextTokenWithColon(JSONToken.LBRACE);
          args[0] = CollectionDeserializer.instance.deserialze(
              parser, fieldType, null);
View Full Code Here

          args[0] = StringDeserializer.deserialze(parser);
        } else if (fieldClass == long.class) {
          lexer.nextTokenWithColon(JSONToken.LITERAL_INT);
          args[0] = LongDeserializer.deserialze(parser);
        } else if (fieldClass == List.class) {
          lexer.nextTokenWithColon(JSONToken.LBRACE);
          args[0] = CollectionDeserializer.instance.deserialze(
              parser, fieldType, null);
        } else {
          ObjectDeserializer fieldValueDeserializer = parser
              .getConfig().getDeserializer(fieldClass, fieldType);
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.