com.googlecode.flyway.core.util
Class ClassUtils

java.lang.Object
  extended by com.googlecode.flyway.core.util.ClassUtils

public class ClassUtils
extends java.lang.Object

Utility methods for dealing with classes.


Method Summary
static java.lang.String getShortName(java.lang.Class<?> aClass)
          Computes the short name (name without package) of this class.
static
<T> T
instantiate(java.lang.String className)
          Creates a new instance of this class.
static boolean isPresent(java.lang.String className)
          Determine whether the Class identified by the supplied name is present and can be loaded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instantiate

public static <T> T instantiate(java.lang.String className)
                     throws java.lang.Exception
Creates a new instance of this class.

Type Parameters:
T - The type of the new instance.
Parameters:
className - The fully qualified name of the class to instantiate.
Returns:
The new instance.
Throws:
java.lang.Exception - Thrown when the instantiation failed.

isPresent

public static boolean isPresent(java.lang.String className)
Determine whether the Class identified by the supplied name is present and can be loaded. Will return false if either the class or one of its dependencies is not present or cannot be loaded.

Parameters:
className - the name of the class to check
Returns:
whether the specified class is present

getShortName

public static java.lang.String getShortName(java.lang.Class<?> aClass)
Computes the short name (name without package) of this class.

Parameters:
aClass - The class to analyse.
Returns:
The short name.


Copyright © 2012. All Rights Reserved.