Remove deprecated methods

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@754522 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2009-03-14 21:24:04 +00:00
parent a4548304f9
commit 71711e3cf8
2 changed files with 1 additions and 50 deletions

View File

@ -35,6 +35,7 @@ import java.io.Serializable;
* @since 1.0
* @version $Id$
*/
//@Immutable
public class ObjectUtils {
/**
@ -186,38 +187,6 @@ public class ObjectUtils {
.append(Integer.toHexString(System.identityHashCode(object)));
}
/**
* <p>Appends the toString that would be produced by <code>Object</code>
* if a class did not override toString itself. <code>null</code>
* will return <code>null</code>.</p>
*
* <pre>
* ObjectUtils.appendIdentityToString(*, null) = null
* ObjectUtils.appendIdentityToString(null, "") = "java.lang.String@1e23"
* ObjectUtils.appendIdentityToString(null, Boolean.TRUE) = "java.lang.Boolean@7fa"
* ObjectUtils.appendIdentityToString(buf, Boolean.TRUE) = buf.append("java.lang.Boolean@7fa")
* </pre>
*
* @param buffer the buffer to append to, may be <code>null</code>
* @param object the object to create a toString for, may be <code>null</code>
* @return the default toString text, or <code>null</code> if
* <code>null</code> passed in
* @since 2.0
* @deprecated The design of this method is bad - see LANG-360. Instead, use identityToString(StringBuffer, Object).
*/
public static StringBuffer appendIdentityToString(StringBuffer buffer, Object object) {
if (object == null) {
return null;
}
if (buffer == null) {
buffer = new StringBuffer();
}
return buffer
.append(object.getClass().getName())
.append('@')
.append(Integer.toHexString(System.identityHashCode(object)));
}
// ToString
//-----------------------------------------------------------------------
/**

View File

@ -158,24 +158,6 @@ public class ObjectUtilsTest extends TestCase {
}
}
public void testAppendIdentityToString() {
assertEquals(null, ObjectUtils.appendIdentityToString(null, null));
assertEquals(null, ObjectUtils.appendIdentityToString(new StringBuffer(), null));
assertEquals(
"java.lang.String@" + Integer.toHexString(System.identityHashCode(FOO)),
ObjectUtils.appendIdentityToString(null, FOO).toString());
assertEquals(
"java.lang.String@" + Integer.toHexString(System.identityHashCode(FOO)),
ObjectUtils.appendIdentityToString(new StringBuffer(), FOO).toString());
Integer val = new Integer(90);
assertEquals(
"java.lang.Integer@" + Integer.toHexString(System.identityHashCode(val)),
ObjectUtils.appendIdentityToString(null, val).toString());
assertEquals(
"java.lang.Integer@" + Integer.toHexString(System.identityHashCode(val)),
ObjectUtils.appendIdentityToString(new StringBuffer(), val).toString());
}
public void testToString_Object() {
assertEquals("", ObjectUtils.toString((Object) null) );
assertEquals(Boolean.TRUE.toString(), ObjectUtils.toString(Boolean.TRUE) );