mirror of
https://github.com/alibaba/fastjson.git
synced 2026-10-29 06:06:50 +08:00
remove codegen
This commit is contained in:
@@ -1391,6 +1391,30 @@ public class DefaultJSONParser extends AbstractJSONParser implements Closeable {
|
||||
this.context = context;
|
||||
this.referenceValue = referenceValue;
|
||||
}
|
||||
|
||||
public ParseContext getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public String getReferenceValue() {
|
||||
return referenceValue;
|
||||
}
|
||||
|
||||
public FieldDeserializer getFieldDeserializer() {
|
||||
return fieldDeserializer;
|
||||
}
|
||||
|
||||
public void setFieldDeserializer(FieldDeserializer fieldDeserializer) {
|
||||
this.fieldDeserializer = fieldDeserializer;
|
||||
}
|
||||
|
||||
public ParseContext getOwnerContext() {
|
||||
return ownerContext;
|
||||
}
|
||||
|
||||
public void setOwnerContext(ParseContext ownerContext) {
|
||||
this.ownerContext = ownerContext;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -110,14 +110,14 @@ public enum Feature {
|
||||
}
|
||||
|
||||
public static boolean isEnabled(int features, Feature feature) {
|
||||
return (features & feature.getMask()) != 0;
|
||||
return (features & feature.mask) != 0;
|
||||
}
|
||||
|
||||
public static int config(int features, Feature feature, boolean state) {
|
||||
if (state) {
|
||||
features |= feature.getMask();
|
||||
features |= feature.mask;
|
||||
} else {
|
||||
features &= ~feature.getMask();
|
||||
features &= ~feature.mask;
|
||||
}
|
||||
|
||||
return features;
|
||||
@@ -131,7 +131,7 @@ public enum Feature {
|
||||
int value = 0;
|
||||
|
||||
for (Feature feature: features) {
|
||||
value |= feature.getMask();
|
||||
value |= feature.mask;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
@@ -368,10 +368,6 @@ public abstract class JSONLexerBase implements JSONLexer, Closeable {
|
||||
nextTokenWithChar(':');
|
||||
}
|
||||
|
||||
public final void nextTokenWithComma() {
|
||||
nextTokenWithChar(':');
|
||||
}
|
||||
|
||||
public final void nextTokenWithChar(char expect) {
|
||||
sp = 0;
|
||||
|
||||
@@ -511,84 +507,6 @@ public abstract class JSONLexerBase implements JSONLexer, Closeable {
|
||||
nextTokenWithChar(',');
|
||||
}
|
||||
|
||||
public final void nextTokenWithChar(char seperator, int expect) {
|
||||
sp = 0;
|
||||
|
||||
for (;;) {
|
||||
if (ch == seperator) {
|
||||
next();
|
||||
break;
|
||||
}
|
||||
|
||||
if (isWhitespace(ch)) {
|
||||
next();
|
||||
continue;
|
||||
}
|
||||
|
||||
throw new JSONException("not match " + expect + " - " + ch);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (expect == JSONToken.LITERAL_INT) {
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
pos = bp;
|
||||
scanNumber();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ch == '"') {
|
||||
pos = bp;
|
||||
scanString();
|
||||
return;
|
||||
}
|
||||
} else if (expect == JSONToken.LITERAL_STRING) {
|
||||
if (ch == '"') {
|
||||
pos = bp;
|
||||
scanString();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
pos = bp;
|
||||
scanNumber();
|
||||
return;
|
||||
}
|
||||
|
||||
} else if (expect == JSONToken.LBRACE) {
|
||||
if (ch == '{') {
|
||||
token = JSONToken.LBRACE;
|
||||
next();
|
||||
return;
|
||||
}
|
||||
if (ch == '[') {
|
||||
token = JSONToken.LBRACKET;
|
||||
next();
|
||||
return;
|
||||
}
|
||||
} else if (expect == JSONToken.LBRACKET) {
|
||||
if (ch == '[') {
|
||||
token = JSONToken.LBRACKET;
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ch == '{') {
|
||||
token = JSONToken.LBRACE;
|
||||
next();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (isWhitespace(ch)) {
|
||||
next();
|
||||
continue;
|
||||
}
|
||||
|
||||
nextToken();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public float floatValue() {
|
||||
return Float.parseFloat(numberString());
|
||||
}
|
||||
|
||||
Executable → Regular
@@ -138,27 +138,27 @@ public enum SerializerFeature {
|
||||
mask = (1 << ordinal());
|
||||
}
|
||||
|
||||
private final int mask;
|
||||
public final int mask;
|
||||
|
||||
public final int getMask() {
|
||||
return mask;
|
||||
}
|
||||
|
||||
public static boolean isEnabled(int features, SerializerFeature feature) {
|
||||
return (features & feature.getMask()) != 0;
|
||||
return (features & feature.mask) != 0;
|
||||
}
|
||||
|
||||
public static boolean isEnabled(int features, int fieaturesB, SerializerFeature feature) {
|
||||
int mask = feature.getMask();
|
||||
int mask = feature.mask;
|
||||
|
||||
return (features & mask) != 0 || (fieaturesB & mask) != 0;
|
||||
}
|
||||
|
||||
public static int config(int features, SerializerFeature feature, boolean state) {
|
||||
if (state) {
|
||||
features |= feature.getMask();
|
||||
features |= feature.mask;
|
||||
} else {
|
||||
features &= ~feature.getMask();
|
||||
features &= ~feature.mask;
|
||||
}
|
||||
|
||||
return features;
|
||||
@@ -172,7 +172,7 @@ public enum SerializerFeature {
|
||||
int value = 0;
|
||||
|
||||
for (SerializerFeature feature: features) {
|
||||
value |= feature.getMask();
|
||||
value |= feature.mask;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
Reference in New Issue
Block a user