org.slim3.commons.util
Class ClassUtil

java.lang.Object
  extended by org.slim3.commons.util.ClassUtil

public final class ClassUtil
extends Object

A utility class for Class.

Since:
3.0
Author:
higa

Method Summary
static Class<?> forName(String className)
          Returns a class instance.
static Constructor<?> getConstructor(Class<?> clazz, Class<?>... parameterTypes)
          Returns the constructor.
static boolean isPresent(String className)
          Determines if the class is present.
static
<T> T
newInstance(Class<?> clazz)
          Creates a new instance.
static
<T> T
newInstance(String className)
          Creates a new instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

forName

public static Class<?> forName(String className)
Returns a class instance.

Parameters:
className - the class name
Returns:
a class instance
Throws:
ClassNotFoundRuntimeException - if ClassNotFoundException is encountered

newInstance

public static <T> T newInstance(Class<?> clazz)
Creates a new instance.

Type Parameters:
T - the target type
Parameters:
clazz - the class
Returns:
a new instance
Throws:
InstantiationRuntimeException - if InstantiationException is encountered.
IllegalAccessRuntimeException - if IllegalAccessException is encountered.

newInstance

public static <T> T newInstance(String className)
Creates a new instance.

Type Parameters:
T - the target type
Parameters:
className - the class name
Returns:
a new instance

getConstructor

public static Constructor<?> getConstructor(Class<?> clazz,
                                            Class<?>... parameterTypes)
Returns the constructor.

Parameters:
clazz - the target class
parameterTypes - the parameter types.
Returns:
the constructor

isPresent

public static boolean isPresent(String className)
Determines if the class is present.

Parameters:
className - the class name
Returns:
whether the class is present


Copyright © 2008-2009 The Slim3 project. All Rights Reserved.