Use Objects.toString()

This commit is contained in:
Gary Gregory 2024-06-11 10:53:54 -04:00
parent 65b479f62b
commit a7871a6bdb
1 changed files with 4 additions and 2 deletions

View File

@ -1274,9 +1274,9 @@ public class ObjectUtils {
* ObjectUtils.toString(Boolean.TRUE) = "true" * ObjectUtils.toString(Boolean.TRUE) = "true"
* </pre> * </pre>
* *
* @see StringUtils#defaultString(String)
* @see Objects#toString(Object) * @see Objects#toString(Object)
* @see Objects#toString(Object, String) * @see Objects#toString(Object, String)
* @see StringUtils#defaultString(String)
* @see String#valueOf(Object) * @see String#valueOf(Object)
* @param obj the Object to {@code toString}, may be null * @param obj the Object to {@code toString}, may be null
* @return the passed in Object's toString, or {@code ""} if {@code null} input * @return the passed in Object's toString, or {@code ""} if {@code null} input
@ -1302,6 +1302,8 @@ public class ObjectUtils {
* ObjectUtils.toString(Boolean.TRUE, "null") = "true" * ObjectUtils.toString(Boolean.TRUE, "null") = "true"
* </pre> * </pre>
* *
* @see Objects#toString(Object)
* @see Objects#toString(Object, String)
* @see StringUtils#defaultString(String,String) * @see StringUtils#defaultString(String,String)
* @see String#valueOf(Object) * @see String#valueOf(Object)
* @param obj the Object to {@code toString}, may be null * @param obj the Object to {@code toString}, may be null
@ -1313,7 +1315,7 @@ public class ObjectUtils {
*/ */
@Deprecated @Deprecated
public static String toString(final Object obj, final String nullStr) { public static String toString(final Object obj, final String nullStr) {
return obj == null ? nullStr : obj.toString(); return Objects.toString(obj, nullStr);
} }
/** /**