Java Code Examples for com.alibaba.fastjson.parser.JSONToken#LBRACKET
The following examples show how to use
com.alibaba.fastjson.parser.JSONToken#LBRACKET .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSerializer.java From joyrpc with Apache License 2.0 | 5 votes |
/** * 读取字符串数组 * * @param parser 解析器 * @param lexer 文法 * @param field 字段 */ protected String[] parseStrings(final DefaultJSONParser parser, final JSONLexer lexer, final String field) { String result[] = null; switch (lexer.token()) { case JSONToken.LBRACKET: result = parser.parseObject(String[].class); break; case JSONToken.NULL: lexer.nextToken(); break; default: throw new SerializerException("syntax error: invalid " + field); } return result; }
Example 2
Source File: ASMDeserializerFactory.java From uavstack with Apache License 2.0 | 5 votes |
private void _quickNextToken(Context context, MethodVisitor mw, int token) { Label quickElse_ = new Label(), quickEnd_ = new Label(); mw.visitVarInsn(ALOAD, context.var("lexer")); mw.visitMethodInsn(INVOKEVIRTUAL, JSONLexerBase, "getCurrent", "()C"); if (token == JSONToken.LBRACE) { mw.visitVarInsn(BIPUSH, '{'); } else if (token == JSONToken.LBRACKET) { mw.visitVarInsn(BIPUSH, '['); } else { throw new IllegalStateException(); } mw.visitJumpInsn(IF_ICMPNE, quickElse_); mw.visitVarInsn(ALOAD, context.var("lexer")); mw.visitMethodInsn(INVOKEVIRTUAL, JSONLexerBase, "next", "()C"); mw.visitInsn(POP); mw.visitVarInsn(ALOAD, context.var("lexer")); mw.visitLdcInsn(token); mw.visitMethodInsn(INVOKEVIRTUAL, JSONLexerBase, "setToken", "(I)V"); mw.visitJumpInsn(GOTO, quickEnd_); mw.visitLabel(quickElse_); mw.visitVarInsn(ALOAD, context.var("lexer")); mw.visitLdcInsn(token); mw.visitMethodInsn(INVOKEVIRTUAL, JSONLexerBase, "nextToken", "(I)V"); mw.visitLabel(quickEnd_); }
Example 3
Source File: ObjectTypeAdapter.java From java-unified-sdk with Apache License 2.0 | 4 votes |
public int getFastMatchToken() { return JSONToken.LBRACKET; }
Example 4
Source File: BaseOperationAdapter.java From java-unified-sdk with Apache License 2.0 | 4 votes |
public int getFastMatchToken() { return JSONToken.LBRACKET; }
Example 5
Source File: ArrayListTypeFieldDeserializer.java From uavstack with Apache License 2.0 | 4 votes |
public int getFastMatchToken() { return JSONToken.LBRACKET; }
Example 6
Source File: JavaBeanDeserializer.java From uavstack with Apache License 2.0 | 4 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) protected static void parseArray(Collection collection, // ObjectDeserializer deser, // DefaultJSONParser parser, // Type type, // Object fieldName) { final JSONLexerBase lexer = (JSONLexerBase) parser.lexer; int token = lexer.token(); if (token == JSONToken.NULL) { lexer.nextToken(JSONToken.COMMA); token = lexer.token(); return; } if (token != JSONToken.LBRACKET) { parser.throwException(token); } char ch = lexer.getCurrent(); if (ch == '[') { lexer.next(); lexer.setToken(JSONToken.LBRACKET); } else { lexer.nextToken(JSONToken.LBRACKET); } if (lexer.token() == JSONToken.RBRACKET) { lexer.nextToken(); return; } int index = 0; for (;;) { Object item = deser.deserialze(parser, type, index); collection.add(item); index++; if (lexer.token() == JSONToken.COMMA) { ch = lexer.getCurrent(); if (ch == '[') { lexer.next(); lexer.setToken(JSONToken.LBRACKET); } else { lexer.nextToken(JSONToken.LBRACKET); } } else { break; } } token = lexer.token(); if (token != JSONToken.RBRACKET) { parser.throwException(token); } ch = lexer.getCurrent(); if (ch == ',') { lexer.next(); lexer.setToken(JSONToken.COMMA); } else { lexer.nextToken(JSONToken.COMMA); } // parser.accept(JSONToken.RBRACKET, JSONToken.COMMA); }
Example 7
Source File: ObjectArrayCodec.java From uavstack with Apache License 2.0 | 4 votes |
public int getFastMatchToken() { return JSONToken.LBRACKET; }
Example 8
Source File: CollectionCodec.java From uavstack with Apache License 2.0 | 4 votes |
public int getFastMatchToken() { return JSONToken.LBRACKET; }
Example 9
Source File: AtomicCodec.java From uavstack with Apache License 2.0 | 4 votes |
public int getFastMatchToken() { return JSONToken.LBRACKET; }
Example 10
Source File: PageDeserializer.java From phone with Apache License 2.0 | 4 votes |
public int getFastMatchToken() { return JSONToken.LBRACKET; }