tigase.util
Class ClassUtil

java.lang.Object
  extended by tigase.util.ClassUtil

public class ClassUtil
extends Object

ClassUtil file contains code used for loading all implementations of specified interface or abstract class found in classpath. As a result of calling some functions you can have Set containing all required classes.

Created: Wed Oct 6 08:25:52 2004

Version:
$Rev: 644 $
Author:
Artur Hefczyc

Constructor Summary
ClassUtil()
           
 
Method Summary
static Set<Class> getClassesFromClassPath()
          Method description
static Set<Class> getClassesFromNames(Set<String> names)
          Method description
static
<T extends Class>
Set<T>
getClassesImplementing(Set<Class> classes, T cls)
          Method description
static
<T extends Class>
Set<T>
getClassesImplementing(T cls)
          Method description
static String getClassNameFromFileName(String fileName)
          Method description
static Set<String> getClassNamesFromDir(File dir)
          Method description
static Set<String> getClassNamesFromJar(File jarFile)
          Method description
static Set<String> getFileListDeep(File path)
          Method description
static
<T> Set<T>
getImplementations(Class<T> obj)
          Method description
static void walkInDirForFiles(File base_dir, String path, Set<String> set)
          Method description
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassUtil

public ClassUtil()
Method Detail

getClassNameFromFileName

public static String getClassNameFromFileName(String fileName)
Method description

Parameters:
fileName -
Returns:

getClassNamesFromDir

public static Set<String> getClassNamesFromDir(File dir)
Method description

Parameters:
dir -
Returns:

getClassNamesFromJar

public static Set<String> getClassNamesFromJar(File jarFile)
                                        throws IOException
Method description

Parameters:
jarFile -
Returns:
Throws:
IOException

getClassesFromClassPath

public static Set<Class> getClassesFromClassPath()
                                          throws IOException,
                                                 ClassNotFoundException
Method description

Returns:
Throws:
ClassNotFoundException
IOException

getClassesFromNames

public static Set<Class> getClassesFromNames(Set<String> names)
                                      throws ClassNotFoundException
Method description

Parameters:
names -
Returns:
Throws:
ClassNotFoundException

getClassesImplementing

public static <T extends Class> Set<T> getClassesImplementing(Set<Class> classes,
                                                              T cls)
Method description

Type Parameters:
T -
Parameters:
classes -
cls -
Returns:

getClassesImplementing

public static <T extends Class> Set<T> getClassesImplementing(T cls)
                                                   throws IOException,
                                                          ClassNotFoundException
Method description

Type Parameters:
T -
Parameters:
cls -
Returns:
Throws:
ClassNotFoundException
IOException

getFileListDeep

public static Set<String> getFileListDeep(File path)
Method description

Parameters:
path -
Returns:

getImplementations

public static <T> Set<T> getImplementations(Class<T> obj)
                                 throws IOException,
                                        ClassNotFoundException,
                                        InstantiationException,
                                        IllegalAccessException
Method description

Type Parameters:
T -
Parameters:
obj -
Returns:
Throws:
ClassNotFoundException
IOException
IllegalAccessException
InstantiationException

walkInDirForFiles

public static void walkInDirForFiles(File base_dir,
                                     String path,
                                     Set<String> set)
Method description

Parameters:
base_dir -
path -
set -


Copyright © 2012 Tigase. All Rights Reserved.