MCPcopy Create free account
hub / github.com/jwtk/jjwt / nullSafeToString

Method nullSafeToString

api/src/main/java/io/jsonwebtoken/lang/Objects.java:671–707  ·  view source on GitHub ↗

Return a String representation of the specified Object. Builds a String representation of the contents in case of an array. Returns "null" if obj is null . @param obj the object to build a String representation for @return a String representation of ob

(Object obj)

Source from the content-addressed store, hash-verified

669 * @return a String representation of <code>obj</code>
670 */
671 public static String nullSafeToString(Object obj) {
672 if (obj == null) {
673 return NULL_STRING;
674 }
675 if (obj instanceof String) {
676 return (String) obj;
677 }
678 if (obj instanceof Object[]) {
679 return nullSafeToString((Object[]) obj);
680 }
681 if (obj instanceof boolean[]) {
682 return nullSafeToString((boolean[]) obj);
683 }
684 if (obj instanceof byte[]) {
685 return nullSafeToString((byte[]) obj);
686 }
687 if (obj instanceof char[]) {
688 return nullSafeToString((char[]) obj);
689 }
690 if (obj instanceof double[]) {
691 return nullSafeToString((double[]) obj);
692 }
693 if (obj instanceof float[]) {
694 return nullSafeToString((float[]) obj);
695 }
696 if (obj instanceof int[]) {
697 return nullSafeToString((int[]) obj);
698 }
699 if (obj instanceof long[]) {
700 return nullSafeToString((long[]) obj);
701 }
702 if (obj instanceof short[]) {
703 return nullSafeToString((short[]) obj);
704 }
705 String str = obj.toString();
706 return (str != null ? str : EMPTY_STRING);
707 }
708
709 /**
710 * Return a String representation of the contents of the specified array.

Callers 3

applyMethod · 0.95
getDisplayStringMethod · 0.95

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected