@@ -238,8 +238,7 @@ public void setError(Boolean error) {
238238
239239 @ Override
240240 public boolean equals (Object obj ) {
241- return obj instanceof MessageFilter
242- && equals ((MessageFilter ) obj );
241+ return obj instanceof MessageFilter filter && equals (filter );
243242 }
244243
245244 /** Check if the filter has logically identical criteria */
@@ -308,15 +307,15 @@ public String toDisplayString(Map<Integer, String> connectors, String padding, b
308307 }
309308
310309 if (minMessageId != null ) {
311- if (text .length () > 0 ) text .append (padding );
310+ if (! text .isEmpty () ) text .append (padding );
312311 text .append ("Min Message Id: " );
313312 text .append (minMessageId );
314313 }
315314
316315 DateFormat dateFormat = new SimpleDateFormat ("yyyy-MM-dd HH:mm" );
317316
318317 if (includeEmptyCriteria || startDate != null || endDate != null ) {
319- if (text .length () > 0 ) text .append (padding );
318+ if (! text .isEmpty () ) text .append (padding );
320319 text .append ("Date Range: " );
321320
322321 if (startDate == null ) {
@@ -335,7 +334,7 @@ public String toDisplayString(Map<Integer, String> connectors, String padding, b
335334 }
336335
337336 if (includeEmptyCriteria || (statuses != null && !statuses .isEmpty ())) {
338- if (text .length () > 0 ) text .append (padding );
337+ if (! text .isEmpty () ) text .append (padding );
339338 text .append ("Statuses: " );
340339
341340 if (statuses == null ) {
@@ -346,47 +345,60 @@ public String toDisplayString(Map<Integer, String> connectors, String padding, b
346345 }
347346
348347 if (textSearch != null ) {
349- if (text .length () > 0 ) text .append (padding );
350- text .append ("Text Search: " + textSearch );
348+ if (!text .isEmpty ()) text .append (padding );
349+ text .append ("Text Search: " );
350+ text .append (textSearch );
351351 }
352352
353353 if (includeEmptyCriteria
354354 || (includedMetaDataIds != null && !includedMetaDataIds .isEmpty ())
355- || (excludedMetaDataIds != null && !excludedMetaDataIds .isEmpty ())) {
355+ || (excludedMetaDataIds != null && !excludedMetaDataIds .isEmpty ())
356+ ) {
356357 getConnectorSearchCriteriaText (text , padding , connectors );
357358 }
358359
359360 if (originalIdLower != null || originalIdUpper != null ) {
360- if (text .length () > 0 ) text .append (padding );
361+ if (! text .isEmpty () ) text .append (padding );
361362 text .append ("Original Id: " );
362363 if (originalIdUpper == null ) {
363- text .append ("Greater than " + originalIdLower );
364+ text .append ("Greater than " );
365+ text .append (originalIdLower );
364366 } else if (originalIdLower == null ) {
365- text .append ("Less than " + originalIdUpper );
367+ text .append ("Less than " );
368+ text .append (originalIdUpper );
366369 } else {
367- text .append ("Between " + originalIdLower + " and " + originalIdUpper );
370+ text .append ("Between " );
371+ text .append (originalIdLower );
372+ text .append (" and " );
373+ text .append (originalIdUpper );
368374 }
369375 }
370376
371377 if (importIdLower != null || importIdUpper != null ) {
372- if (text .length () > 0 ) text .append (padding );
378+ if (! text .isEmpty () ) text .append (padding );
373379 text .append ("Import Id: " );
374380 if (importIdUpper == null ) {
375- text .append ("Greater than " + importIdLower );
381+ text .append ("Greater than " );
382+ text .append (importIdLower );
376383 } else if (importIdLower == null ) {
377- text .append ("Less than " + importIdUpper );
384+ text .append ("Less than " );
385+ text .append (importIdUpper );
378386 } else {
379- text .append ("Between " + importIdLower + " and " + importIdUpper );
387+ text .append ("Between " );
388+ text .append (importIdLower );
389+ text .append (" and " );
390+ text .append (importIdUpper );
380391 }
381392 }
382393
383394 if (serverId != null ) {
384- if (text .length () > 0 ) text .append (padding );
385- text .append ("Server Id: " + serverId );
395+ if (!text .isEmpty ()) text .append (padding );
396+ text .append ("Server Id: " );
397+ text .append (serverId );
386398 }
387399
388400 if (sendAttemptsLower != null || sendAttemptsUpper != null ) {
389- if (text .length () > 0 ) text .append (padding );
401+ if (! text .isEmpty () ) text .append (padding );
390402 text .append ("# of Send Attempts: " );
391403
392404 if (sendAttemptsLower != null ) {
@@ -407,19 +419,24 @@ public String toDisplayString(Map<Integer, String> connectors, String padding, b
407419 if (contentSearch != null ) {
408420 for (ContentSearchElement element : contentSearch ) {
409421 for (String value : element .getSearches ()) {
410- if (text .length () > 0 ) text .append (padding );
411- text .append (ContentType .fromCode (element .getContentCode ()) + " contains \" " + value + "\" " );
422+ if (!text .isEmpty ()) text .append (padding );
423+ text .append (ContentType .fromCode (element .getContentCode ()));
424+ text .append (" contains \" " );
425+ text .append (value );
426+ text .append ("\" " );
412427 }
413428 }
414429 }
415430
416431 if (metaDataSearch != null ) {
417432 for (MetaDataSearchElement element : metaDataSearch ) {
418- if (text .length () > 0 ) text .append (padding );
419- text .append (element .getColumnName () + " " + MetaDataSearchOperator .fromString (element .getOperator ()).toString () + " " );
420- if (element .getValue () instanceof Calendar ) {
421- Calendar date = (Calendar ) element .getValue ();
422- text .append (new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss" ).format (date .getTime ()));
433+ if (!text .isEmpty ()) text .append (padding );
434+ text .append (element .getColumnName ());
435+ text .append (" " );
436+ text .append (MetaDataSearchOperator .fromString (element .getOperator ()).toString ());
437+ text .append (" " );
438+ if (element .getValue () instanceof Calendar calendar ) {
439+ text .append (new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss" ).format (calendar .getTime ()));
423440 } else {
424441 text .append (element .getValue ());
425442 }
@@ -430,12 +447,12 @@ public String toDisplayString(Map<Integer, String> connectors, String padding, b
430447 }
431448
432449 if (Boolean .TRUE .equals (attachment )) {
433- if (text .length () > 0 ) text .append (padding );
450+ if (! text .isEmpty () ) text .append (padding );
434451 text .append ("Has Attachment" );
435452 }
436453
437454 if (Boolean .TRUE .equals (error )) {
438- if (text .length () > 0 ) text .append (padding );
455+ if (! text .isEmpty () ) text .append (padding );
439456 text .append ("Has Error" );
440457 }
441458
@@ -447,7 +464,7 @@ public String toDisplayString(Map<Integer, String> connectors, String padding, b
447464 }
448465
449466 private void getConnectorSearchCriteriaText (StringBuilder text , String padding , Map <Integer , String > connectors ) {
450- if (text .length () > 0 ) text .append (padding );
467+ if (! text .isEmpty () ) text .append (padding );
451468 text .append ("Connectors: " );
452469
453470 if (includedMetaDataIds == null ) {
0 commit comments