From 3e439de47bb1bfb8c022bd2a7b3022fbb66e6849 Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Thu, 14 Aug 2003 00:10:42 +0000 Subject: [PATCH] Use ClassUtils to get the short class name suggested by Pete Gieser git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137591 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/lang/builder/ToStringStyle.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/java/org/apache/commons/lang/builder/ToStringStyle.java b/src/java/org/apache/commons/lang/builder/ToStringStyle.java index 9459f8598..fb89240f7 100644 --- a/src/java/org/apache/commons/lang/builder/ToStringStyle.java +++ b/src/java/org/apache/commons/lang/builder/ToStringStyle.java @@ -58,6 +58,7 @@ import java.lang.reflect.Array; import java.util.Collection; import java.util.Map; +import org.apache.commons.lang.ClassUtils; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.SystemUtils; @@ -86,7 +87,7 @@ import org.apache.commons.lang.SystemUtils; * @author Gary Gregory * @author Pete Gieser * @since 1.0 - * @version $Id: ToStringStyle.java,v 1.21 2003/07/25 23:04:24 ggregory Exp $ + * @version $Id: ToStringStyle.java,v 1.22 2003/08/14 00:10:42 scolebourne Exp $ */ public abstract class ToStringStyle implements Serializable { @@ -1426,12 +1427,7 @@ public abstract class ToStringStyle implements Serializable { * @return the short name */ protected String getShortClassName(Class cls) { - String name = cls.getName(); - int pos = name.lastIndexOf('.'); - if (pos == -1) { - return name; - } - return name.substring(pos + 1); + return ClassUtils.getShortClassName(cls); } // Setters and getters for the customizable parts of the style