Here you can find the source of simpleClassName(final String className)
Parameter | Description |
---|---|
className | the fully qualified class name |
public static String simpleClassName(final String className)
//package com.java2s; /*//from w ww.j a v a2s. c o m * StringUtils.java * * Created on October 4, 2006, 2:36 PM * * Description: * * Copyright (C) 2006 Stephen L. Reed. * * This program is free software; you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with this program; * if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ public class Main { /** Returns the simple class name from the fully qualified class name. * * @param className the fully qualified class name * @return the package name */ public static String simpleClassName(final String className) { //Preconditions assert className != null : "className must not be null"; assert !className.isEmpty() : "className must not be empty"; final int index = className.lastIndexOf('.'); assert index > -1 : "cannot find package in import " + className; return className.substring(index + 1); } }