Refactor magic char.

This commit is contained in:
Gary Gregory 2017-11-10 11:31:33 -07:00
parent 8dae1f2904
commit 4f928504ea
1 changed files with 6 additions and 4 deletions

View File

@ -46,6 +46,8 @@ import org.apache.commons.lang3.text.StrBuilder;
// because it is part of the signature of deprecated methods
public class ObjectUtils {
private static final char AT_SIGN = '@';
/**
* <p>Singleton used as a {@code null} placeholder where
* {@code null} has another meaning.</p>
@ -355,7 +357,7 @@ public class ObjectUtils {
public static void identityToString(final Appendable appendable, final Object object) throws IOException {
Validate.notNull(object, "Cannot get the toString of a null object");
appendable.append(object.getClass().getName())
.append('@')
.append(AT_SIGN)
.append(Integer.toHexString(System.identityHashCode(object)));
}
@ -380,7 +382,7 @@ public class ObjectUtils {
public static void identityToString(final StrBuilder builder, final Object object) {
Validate.notNull(object, "Cannot get the toString of a null object");
builder.append(object.getClass().getName())
.append('@')
.append(AT_SIGN)
.append(Integer.toHexString(System.identityHashCode(object)));
}
@ -402,7 +404,7 @@ public class ObjectUtils {
public static void identityToString(final StringBuffer buffer, final Object object) {
Validate.notNull(object, "Cannot get the toString of a null object");
buffer.append(object.getClass().getName())
.append('@')
.append(AT_SIGN)
.append(Integer.toHexString(System.identityHashCode(object)));
}
@ -424,7 +426,7 @@ public class ObjectUtils {
public static void identityToString(final StringBuilder builder, final Object object) {
Validate.notNull(object, "Cannot get the toString of a null object");
builder.append(object.getClass().getName())
.append('@')
.append(AT_SIGN)
.append(Integer.toHexString(System.identityHashCode(object)));
}