001 package com.croftsoft.core.lang.classloader; 002 003 /********************************************************************* 004 * 005 * Static library for use with custom ClassLoaders. 006 * 007 * @version 008 * 1998-10-04 009 * @author 010 * <a href="https://www.croftsoft.com/">David Wallace Croft</a> 011 *********************************************************************/ 012 013 public class ClassLoaderLib 014 ////////////////////////////////////////////////////////////////////// 015 ////////////////////////////////////////////////////////////////////// 016 { 017 018 private ClassLoaderLib ( ) { } 019 020 /********************************************************************* 021 * Parses the package name out of a full class name. 022 * Returns the empty string ("") if the class is not in a package. 023 *********************************************************************/ 024 public static String parsePackageName ( String className ) 025 ////////////////////////////////////////////////////////////////////// 026 { 027 String packageName = ""; 028 int i = className.lastIndexOf ( '.' ); 029 if ( i > -1 ) packageName = className.substring ( 0, i ); 030 return packageName; 031 } 032 033 ////////////////////////////////////////////////////////////////////// 034 ////////////////////////////////////////////////////////////////////// 035 }