Updated Branches: refs/heads/wicket-1.5.x ba9aba837 -> 128f720c2
Remove duplicate method #getSimpleName(Class) Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/128f720c Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/128f720c Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/128f720c Branch: refs/heads/wicket-1.5.x Commit: 128f720c2459b610508805939fd2fe964762eab5 Parents: ba9aba8 Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Sun Sep 2 16:59:36 2012 +0200 Committer: Martin Tzvetanov Grigorov <[email protected]> Committed: Sun Sep 2 16:59:36 2012 +0200 ---------------------------------------------------------------------- .../java/org/apache/wicket/util/lang/Classes.java | 43 +++++---------- 1 files changed, 14 insertions(+), 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/128f720c/wicket-util/src/main/java/org/apache/wicket/util/lang/Classes.java ---------------------------------------------------------------------- diff --git a/wicket-util/src/main/java/org/apache/wicket/util/lang/Classes.java b/wicket-util/src/main/java/org/apache/wicket/util/lang/Classes.java index cef057c..4edeb3b 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/lang/Classes.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/lang/Classes.java @@ -51,28 +51,6 @@ public final class Classes } /** - * Gets the simple name (without the package) of the given class or null if the class is null. - * - * @param c - * The class - * @return The class simple name - */ - public static String simpleName(Class<?> c) - { - String simpleName = null; - if (c != null) - { - while (c.isAnonymousClass()) - { - c = c.getSuperclass(); - } - simpleName = c.getSimpleName(); - } - - return simpleName; - } - - /** * Takes a Class and a relative path to a class and returns any class at that relative path. For * example, if the given Class was java.lang.System and the relative path was "../util/List", * then the java.util.List class would be returned. @@ -90,19 +68,26 @@ public final class Classes return Class.forName(Packages.absolutePath(scope, path).replace('/', '.')); } - /** - * Gets the name of a given class without the prefixed package path - * - * @param <C> + * Gets the simple name (without the package) of the given class or null if the class is null. * * @param c * The class - * @return The class name + * @return The class simple name */ - public static <C> String simpleName(final Class<C> c) + public static String simpleName(Class<?> c) { - return Strings.lastPathComponent(c.getName(), '.'); + String simpleName = null; + if (c != null) + { + while (c.isAnonymousClass()) + { + c = c.getSuperclass(); + } + simpleName = c.getSimpleName(); + } + + return simpleName; } /**
