Add a version of shortClassName that takes the class name directly.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1692 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1298,7 +1298,17 @@ public class StringUtil
|
|||||||
*/
|
*/
|
||||||
public static String shortClassName (Class clazz)
|
public static String shortClassName (Class clazz)
|
||||||
{
|
{
|
||||||
String name = clazz.getName();
|
return shortClassName(clazz.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the supplied class name truncated to one package prior to
|
||||||
|
* the actual class name. For example,
|
||||||
|
* <code>com.samskivert.util.StringUtil</code> would be reported as
|
||||||
|
* <code>util.StringUtil</code>.
|
||||||
|
*/
|
||||||
|
public static String shortClassName (String name)
|
||||||
|
{
|
||||||
int didx = name.lastIndexOf(".");
|
int didx = name.lastIndexOf(".");
|
||||||
if (didx == -1) {
|
if (didx == -1) {
|
||||||
return name;
|
return name;
|
||||||
|
|||||||
Reference in New Issue
Block a user