66
77class CodegenImplObject {
88 public static CodegenResult genObject (ClassInfo classInfo ) {
9- boolean supportBuffer = JsoniterSpi .getCurrentConfig ().indentionStep () == 0 ;
9+ boolean noIndention = JsoniterSpi .getCurrentConfig ().indentionStep () == 0 ;
1010 CodegenResult ctx = new CodegenResult ();
1111 ClassDescriptor desc = ClassDescriptor .getEncodingClassDescriptor (classInfo , false );
1212 List <EncodeTo > encodeTos = desc .encodeTos ();
1313 ctx .append (String .format ("public static void encode_(%s obj, com.jsoniter.output.JsonStream stream) throws java.io.IOException {" , classInfo .clazz .getCanonicalName ()));
1414 if (hasFieldOutput (desc )) {
1515 int notFirst = 0 ;
16- if (supportBuffer ) {
16+ if (noIndention ) {
1717 ctx .buffer ('{' );
1818 } else {
1919 ctx .append ("stream.writeObjectStart();" );
@@ -38,7 +38,7 @@ public static CodegenResult genObject(ClassInfo classInfo) {
3838 ctx .append (String .format ("obj.%s(stream);" , unwrapper .method .getName ()));
3939 }
4040 }
41- if (supportBuffer ) {
41+ if (noIndention ) {
4242 ctx .buffer ('}' );
4343 } else {
4444 ctx .append ("if (notFirst) { stream.writeObjectEnd(); } else { stream.write('}'); }" );
@@ -59,7 +59,7 @@ private static boolean hasFieldOutput(ClassDescriptor desc) {
5959 }
6060
6161 private static int genField (CodegenResult ctx , Binding binding , String toName , int notFirst ) {
62- boolean supportBuffer = JsoniterSpi .getCurrentConfig ().indentionStep () == 0 ;
62+ boolean noIndention = JsoniterSpi .getCurrentConfig ().indentionStep () == 0 ;
6363 String fieldCacheKey = binding .encoderCacheKey ();
6464 Encoder encoder = JsoniterSpi .getEncoder (fieldCacheKey );
6565 boolean isCollectionValueNullable = binding .isCollectionValueNullable ;
@@ -87,14 +87,14 @@ private static int genField(CodegenResult ctx, Binding binding, String toName, i
8787 }
8888 ctx .append (String .format ("if (%s != null) {" , valueAccessor ));
8989 notFirst = appendComma (ctx , notFirst );
90- if (supportBuffer ) {
90+ if (noIndention ) {
9191 ctx .append (CodegenResult .bufferToWriteOp ("\" " + toName + "\" :" ));
9292 } else {
9393 ctx .append (String .format ("stream.writeObjectField(\" %s\" );" , toName ));
9494 }
9595 } else {
9696 notFirst = appendComma (ctx , notFirst );
97- if (supportBuffer ) {
97+ if (noIndention ) {
9898 ctx .buffer ('"' );
9999 ctx .buffer (toName );
100100 ctx .buffer ('"' );
@@ -106,7 +106,7 @@ private static int genField(CodegenResult ctx, Binding binding, String toName, i
106106 }
107107 } else {
108108 notFirst = appendComma (ctx , notFirst );
109- if (supportBuffer ) {
109+ if (noIndention ) {
110110 ctx .buffer ('"' );
111111 ctx .buffer (toName );
112112 ctx .buffer ('"' );
@@ -128,22 +128,22 @@ private static int genField(CodegenResult ctx, Binding binding, String toName, i
128128 }
129129
130130 private static int appendComma (CodegenResult ctx , int notFirst ) {
131- boolean supportBuffer = JsoniterSpi .getCurrentConfig ().indentionStep () == 0 ;
131+ boolean noIndention = JsoniterSpi .getCurrentConfig ().indentionStep () == 0 ;
132132 if (notFirst == 1 ) { // definitely not first
133- if (supportBuffer ) {
133+ if (noIndention ) {
134134 ctx .buffer (',' );
135135 } else {
136136 ctx .append ("stream.writeMore();" );
137137 }
138138 } else if (notFirst == 2 ) { // maybe not first, previous field is omitNull
139- if (supportBuffer ) {
139+ if (noIndention ) {
140140 ctx .append ("if (notFirst) { stream.write(','); } else { notFirst = true; }" );
141141 } else {
142142 ctx .append ("if (notFirst) { stream.writeMore(); } else { stream.writeIndention(); notFirst = true; }" );
143143 }
144144 } else { // this is the first, do not write comma
145145 notFirst = 1 ;
146- if (!supportBuffer ) {
146+ if (!noIndention ) {
147147 ctx .append ("stream.writeIndention();" );
148148 }
149149 }
0 commit comments