use of com.alibaba.fastjson.parser.JSONLexerBase in project fastjson by alibaba.
the class MediaContentGenDecoder method deserialze.
public Object deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
JSONLexerBase lexer = (JSONLexerBase) parser.getLexer();
if (!lexer.isEnabled(Feature.SortFeidFastMatch)) {
return super.deserialze(parser, type, fieldName);
}
if (lexer.isEnabled(Feature.SupportArrayToBean)) {
// deserialzeArrayMapping
}
if (lexer.scanType("Department") == JSONLexerBase.NOT_MATCH) {
return super.deserialze(parser, type, fieldName);
}
ParseContext mark_context = parser.getContext();
int matchedCount = 0;
MediaContent instance = new MediaContent();
ParseContext context = parser.getContext();
ParseContext childContext = parser.setContext(context, instance, fieldName);
if (lexer.matchStat == JSONLexerBase.END) {
return instance;
}
int matchStat = 0;
int _asm_flag_0 = 0;
java.util.List images_gen = null;
data.media.Media media_gen = null;
boolean endFlag = false, restFlag = false;
if ((!endFlag) && (!restFlag)) {
if (lexer.matchField(images_gen_prefix__)) {
_asm_flag_0 |= 1;
if (lexer.token() == JSONToken.NULL) {
lexer.nextToken(JSONToken.COMMA);
} else {
if (lexer.token() == JSONToken.LBRACKET) {
if (images_gen_list_item_deser__ == null) {
images_gen_list_item_deser__ = parser.getConfig().getDeserializer(data.media.Image.class);
}
final int fastMatchToken = images_gen_list_item_deser__.getFastMatchToken();
lexer.nextToken(fastMatchToken);
images_gen = new java.util.ArrayList();
ParseContext listContext = parser.getContext();
parser.setContext(images_gen, "images");
for (int i = 0; ; ++i) {
if (lexer.token() == JSONToken.RBRACKET) {
break;
}
data.media.Image itemValue = images_gen_list_item_deser__.deserialze(parser, images_gen_list_item_type__, i);
images_gen.add(itemValue);
parser.checkListResolve(images_gen);
if (lexer.token() == JSONToken.COMMA) {
lexer.nextToken(fastMatchToken);
}
}
parser.setContext(listContext);
if (lexer.token() != JSONToken.RBRACKET) {
restFlag = true;
}
lexer.nextToken(JSONToken.COMMA);
} else {
restFlag = true;
}
}
}
if (lexer.matchStat > 0) {
_asm_flag_0 |= 1;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat != JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
if (lexer.matchField(media_gen_prefix__)) {
_asm_flag_0 |= 2;
matchedCount++;
if (media_gen_deser__ == null) {
media_gen_deser__ = parser.getConfig().getDeserializer(data.media.Media.class);
}
media_gen_deser__.deserialze(parser, data.media.Media.class, "media");
if (parser.getResolveStatus() == DefaultJSONParser.NeedToResolve) {
ResolveTask resolveTask = parser.getLastResolveTask();
resolveTask.ownerContext = parser.getContext();
resolveTask.fieldDeserializer = this.getFieldDeserializer("media");
parser.setResolveStatus(DefaultJSONParser.NONE);
}
}
if (matchedCount <= 0 || lexer.token() != JSONToken.RBRACE) {
restFlag = true;
} else if (lexer.token() == JSONToken.COMMA) {
lexer.nextToken();
}
if (lexer.matchStat > 0) {
_asm_flag_0 |= 2;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat != JSONLexerBase.END) {
restFlag = true;
}
}
if ((_asm_flag_0 & 1) != 0) {
instance.setImages(images_gen);
}
if ((_asm_flag_0 & 2) != 0) {
instance.setMedia(media_gen);
}
if (restFlag) {
return super.parseRest(parser, type, fieldName, instance, 0, new int[0]);
}
return instance;
}
use of com.alibaba.fastjson.parser.JSONLexerBase in project fastjson by alibaba.
the class ImageGenDecoder method deserialze.
public Object deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
JSONLexerBase lexer = (JSONLexerBase) parser.getLexer();
if (!lexer.isEnabled(Feature.SortFeidFastMatch)) {
return super.deserialze(parser, type, fieldName);
}
if (lexer.isEnabled(Feature.SupportArrayToBean)) {
// deserialzeArrayMapping
}
if (lexer.scanType("Department") == JSONLexerBase.NOT_MATCH) {
return super.deserialze(parser, type, fieldName);
}
ParseContext mark_context = parser.getContext();
int matchedCount = 0;
Image instance = new Image();
ParseContext context = parser.getContext();
ParseContext childContext = parser.setContext(context, instance, fieldName);
if (lexer.matchStat == JSONLexerBase.END) {
return instance;
}
int matchStat = 0;
int _asm_flag_0 = 0;
int height_gen = 0;
data.media.Image.Size size_gen = null;
String title_gen;
if (lexer.isEnabled(Feature.InitStringFieldAsEmpty)) {
title_gen = lexer.stringDefaultValue();
_asm_flag_0 |= 4;
} else {
title_gen = null;
}
String uri_gen;
if (lexer.isEnabled(Feature.InitStringFieldAsEmpty)) {
uri_gen = lexer.stringDefaultValue();
_asm_flag_0 |= 8;
} else {
uri_gen = null;
}
int width_gen = 0;
boolean endFlag = false, restFlag = false;
if ((!endFlag) && (!restFlag)) {
height_gen = lexer.scanFieldInt(height_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 1;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
size_gen = (data.media.Image.Size) this.scanEnum(lexer, size_gen_prefix__, size_gen_deser__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 2;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
title_gen = lexer.scanFieldString(title_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 4;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
uri_gen = lexer.scanFieldString(uri_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 8;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
width_gen = lexer.scanFieldInt(width_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 16;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat != JSONLexerBase.END) {
restFlag = true;
}
}
if ((_asm_flag_0 & 1) != 0) {
instance.setHeight(height_gen);
}
if ((_asm_flag_0 & 2) != 0) {
instance.setSize(size_gen);
}
if ((_asm_flag_0 & 4) != 0) {
instance.setTitle(title_gen);
}
if ((_asm_flag_0 & 8) != 0) {
instance.setUri(uri_gen);
}
if ((_asm_flag_0 & 16) != 0) {
instance.setWidth(width_gen);
}
if (restFlag) {
return super.parseRest(parser, type, fieldName, instance, 0, new int[0]);
}
return instance;
}
use of com.alibaba.fastjson.parser.JSONLexerBase in project fastjson by alibaba.
the class MediaGenDecoder method deserialze.
public Object deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
JSONLexerBase lexer = (JSONLexerBase) parser.getLexer();
if (!lexer.isEnabled(Feature.SortFeidFastMatch)) {
return super.deserialze(parser, type, fieldName);
}
if (lexer.isEnabled(Feature.SupportArrayToBean)) {
// deserialzeArrayMapping
}
if (lexer.scanType("Department") == JSONLexerBase.NOT_MATCH) {
return super.deserialze(parser, type, fieldName);
}
ParseContext mark_context = parser.getContext();
int matchedCount = 0;
Media instance = new Media();
ParseContext context = parser.getContext();
ParseContext childContext = parser.setContext(context, instance, fieldName);
if (lexer.matchStat == JSONLexerBase.END) {
return instance;
}
int matchStat = 0;
int _asm_flag_0 = 0;
int bitrate_gen = 0;
String copyright_gen;
if (lexer.isEnabled(Feature.InitStringFieldAsEmpty)) {
copyright_gen = lexer.stringDefaultValue();
_asm_flag_0 |= 2;
} else {
copyright_gen = null;
}
long duration_gen = 0;
String format_gen;
if (lexer.isEnabled(Feature.InitStringFieldAsEmpty)) {
format_gen = lexer.stringDefaultValue();
_asm_flag_0 |= 8;
} else {
format_gen = null;
}
int height_gen = 0;
java.util.List persons_gen = null;
data.media.Media.Player player_gen = null;
long size_gen = 0;
String title_gen;
if (lexer.isEnabled(Feature.InitStringFieldAsEmpty)) {
title_gen = lexer.stringDefaultValue();
_asm_flag_0 |= 256;
} else {
title_gen = null;
}
String uri_gen;
if (lexer.isEnabled(Feature.InitStringFieldAsEmpty)) {
uri_gen = lexer.stringDefaultValue();
_asm_flag_0 |= 512;
} else {
uri_gen = null;
}
int width_gen = 0;
boolean endFlag = false, restFlag = false;
if ((!endFlag) && (!restFlag)) {
bitrate_gen = lexer.scanFieldInt(bitrate_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 1;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
copyright_gen = lexer.scanFieldString(copyright_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 2;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
duration_gen = lexer.scanFieldLong(duration_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 4;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
format_gen = lexer.scanFieldString(format_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 8;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
height_gen = lexer.scanFieldInt(height_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 16;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
persons_gen = (java.util.List) lexer.scanFieldStringArray(persons_gen_prefix__, java.util.List.class);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 32;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
player_gen = (data.media.Media.Player) this.scanEnum(lexer, player_gen_prefix__, player_gen_deser__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 64;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
size_gen = lexer.scanFieldLong(size_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 128;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
title_gen = lexer.scanFieldString(title_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 256;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
uri_gen = lexer.scanFieldString(uri_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 512;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
width_gen = lexer.scanFieldInt(width_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 1024;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat != JSONLexerBase.END) {
restFlag = true;
}
}
if ((_asm_flag_0 & 1) != 0) {
instance.setBitrate(bitrate_gen);
}
if ((_asm_flag_0 & 2) != 0) {
instance.setCopyright(copyright_gen);
}
if ((_asm_flag_0 & 4) != 0) {
instance.setDuration(duration_gen);
}
if ((_asm_flag_0 & 8) != 0) {
instance.setFormat(format_gen);
}
if ((_asm_flag_0 & 16) != 0) {
instance.setHeight(height_gen);
}
if ((_asm_flag_0 & 32) != 0) {
instance.setPersons(persons_gen);
}
if ((_asm_flag_0 & 64) != 0) {
instance.setPlayer(player_gen);
}
if ((_asm_flag_0 & 128) != 0) {
instance.setSize(size_gen);
}
if ((_asm_flag_0 & 256) != 0) {
instance.setTitle(title_gen);
}
if ((_asm_flag_0 & 512) != 0) {
instance.setUri(uri_gen);
}
if ((_asm_flag_0 & 1024) != 0) {
instance.setWidth(width_gen);
}
if (restFlag) {
return super.parseRest(parser, type, fieldName, instance, 0, new int[0]);
}
return instance;
}
use of com.alibaba.fastjson.parser.JSONLexerBase in project fastjson by alibaba.
the class DepartmentCodec method deserialze.
public Object deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
JSONLexerBase lexer = (JSONLexerBase) parser.getLexer();
if (lexer.isEnabled(Feature.SortFeidFastMatch)) {
return super.deserialze(parser, type, fieldName);
}
if (lexer.isEnabled(Feature.SupportArrayToBean)) {
// deserialzeArrayMapping
}
if (lexer.scanType("Department") == JSONLexerBase.NOT_MATCH) {
return super.deserialze(parser, type, fieldName);
}
ParseContext mark_context = parser.getContext();
int matchedCount = 0;
Department instance = new Department();
ParseContext context = parser.getContext();
ParseContext childContext = parser.setContext(context, instance, fieldName);
if (lexer.matchStat == JSONLexerBase.END) {
return instance;
}
int matchStat = 0;
int _asm_flag_0 = 0;
int id_gen = 0;
com.alibaba.json.test.codegen.Employee leader_gen = null;
java.util.List members_gen = null;
String name_gen;
if (lexer.isEnabled(Feature.InitStringFieldAsEmpty)) {
name_gen = lexer.stringDefaultValue();
_asm_flag_0 |= 8;
} else {
name_gen = null;
}
boolean root_gen = false;
com.alibaba.json.test.codegen.DepartmentType type_gen = null;
boolean endFlag = false, restFlag = false;
if ((!endFlag) && (!restFlag)) {
id_gen = lexer.scanFieldInt(id_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 1;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
if (lexer.matchField(leader_gen_prefix__)) {
_asm_flag_0 |= 2;
matchedCount++;
if (parser.getResolveStatus() == DefaultJSONParser.NeedToResolve) {
ResolveTask resolveTask = parser.getLastResolveTask();
resolveTask.ownerContext = parser.getContext();
resolveTask.fieldDeserializer = this.getFieldDeserializer("leader");
parser.setResolveStatus(DefaultJSONParser.NONE);
}
}
if (lexer.matchStat > 0) {
_asm_flag_0 |= 2;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
if (lexer.matchField(members_gen_prefix__)) {
_asm_flag_0 |= 4;
if (lexer.token() == JSONToken.NULL) {
lexer.nextToken(JSONToken.COMMA);
} else {
if (lexer.token() == JSONToken.LBRACKET) {
if (members_gen_list_item_deser__ == null) {
members_gen_list_item_deser__ = parser.getConfig().getDeserializer(com.alibaba.json.test.codegen.Employee.class);
}
final int fastMatchToken = members_gen_list_item_deser__.getFastMatchToken();
lexer.nextToken(fastMatchToken);
members_gen = new java.util.ArrayList();
ParseContext listContext = parser.getContext();
parser.setContext(members_gen, "members");
for (int i = 0; ; ++i) {
if (lexer.token() == JSONToken.RBRACKET) {
break;
}
com.alibaba.json.test.codegen.Employee itemValue = members_gen_list_item_deser__.deserialze(parser, members_gen_list_item_type__, i);
members_gen.add(itemValue);
parser.checkListResolve(members_gen);
if (lexer.token() == JSONToken.COMMA) {
lexer.nextToken(fastMatchToken);
}
}
parser.setContext(listContext);
if (lexer.token() != JSONToken.RBRACKET) {
restFlag = true;
}
lexer.nextToken(JSONToken.COMMA);
} else {
restFlag = true;
}
}
}
if (lexer.matchStat > 0) {
_asm_flag_0 |= 4;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
name_gen = lexer.scanFieldString(name_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 8;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
root_gen = lexer.scanFieldBoolean(root_gen_prefix__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 16;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat == JSONLexerBase.END) {
endFlag = true;
}
}
if ((!endFlag) && (!restFlag)) {
type_gen = (com.alibaba.json.test.codegen.DepartmentType) this.scanEnum(lexer, type_gen_prefix__, type_gen_deser__);
if (lexer.matchStat > 0) {
_asm_flag_0 |= 32;
matchedCount++;
}
if (lexer.matchStat == JSONLexerBase.NOT_MATCH) {
restFlag = true;
}
if (lexer.matchStat != JSONLexerBase.END) {
restFlag = true;
}
}
if (restFlag) {
return super.parseRest(parser, type, fieldName, instance, 0, new int[0]);
}
return instance;
}
Aggregations