@@ -130,21 +130,26 @@ public FieldInfo(String n) {
130130 @ SuppressWarnings ("unchecked" )
131131 public void read (NamedList <Object > nl ) {
132132 for (Map .Entry <String , Object > entry : nl ) {
133- String key = entry .getKey ();
134- switch ( key ) {
135- case "type" -> type = ( String ) entry .getValue ();
136- case "flags" -> flags = parseFlags ((String ) entry .getValue ());
137- case "schema" -> schema = ( String ) entry .getValue ();
138- case "docs" -> {
139- docs = ( Integer ) entry .getValue ();
140- docsAsLong = (long ) docs ; // widen, lossless
141- }
142- case "docsAsLong" -> docsAsLong = ( Long ) entry .getValue ();
133+ if ( "type" . equals ( entry .getKey ())) {
134+ type = ( String ) entry . getValue ();
135+ } else if ( "flags" . equals ( entry .getKey ())) {
136+ flags = parseFlags ((String ) entry .getValue ());
137+ } else if ( "schema" . equals ( entry .getKey ())) {
138+ schema = ( String ) entry . getValue ();
139+ } else if ( " docs" . equals ( entry .getKey ())) {
140+ docs = (Integer ) entry . getValue ();
141+ docsAsLong = ( long ) docs ; // widen, lossless
142+ } else if ( "docsAsLong" . equals ( entry .getKey ())) {
143143 // Don't set docs — narrowing Long→int is lossy
144- case "distinct" -> distinct = (Integer ) entry .getValue ();
145- case "cacheableFaceting" -> cacheableFaceting = (Boolean ) entry .getValue ();
146- case "topTerms" -> topTerms = (NamedList <Integer >) entry .getValue ();
147- default -> extras .put (key , entry .getValue ());
144+ docsAsLong = (Long ) entry .getValue ();
145+ } else if ("distinct" .equals (entry .getKey ())) {
146+ distinct = (Integer ) entry .getValue ();
147+ } else if ("cacheableFaceting" .equals (entry .getKey ())) {
148+ cacheableFaceting = (Boolean ) entry .getValue ();
149+ } else if ("topTerms" .equals (entry .getKey ())) {
150+ topTerms = (NamedList <Integer >) entry .getValue ();
151+ } else {
152+ extras .put (entry .getKey (), entry .getValue ());
148153 }
149154 }
150155 }
@@ -287,7 +292,9 @@ private Long getIndexLong(String key) {
287292 }
288293
289294 public Integer getNumDocs () {
290- if (indexInfo == null ) return null ;
295+ if (indexInfo == null ) {
296+ return null ;
297+ }
291298 Object val = indexInfo .get ("numDocs" );
292299 return val instanceof Integer i ? i : null ;
293300 }
@@ -297,7 +304,9 @@ public Long getNumDocsAsLong() {
297304 }
298305
299306 public Integer getMaxDoc () {
300- if (indexInfo == null ) return null ;
307+ if (indexInfo == null ) {
308+ return null ;
309+ }
301310 Object val = indexInfo .get ("maxDoc" );
302311 return val instanceof Integer i ? i : null ;
303312 }
@@ -307,7 +316,9 @@ public Long getDeletedDocsAsLong() {
307316 }
308317
309318 public Integer getNumTerms () {
310- if (indexInfo == null ) return null ;
319+ if (indexInfo == null ) {
320+ return null ;
321+ }
311322 Object val = indexInfo .get ("numTerms" );
312323 return val instanceof Integer i ? i : null ;
313324 }
0 commit comments