public class ReflectionUtils
extends java.lang.Object
| Constructor and Description |
|---|
ReflectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> java.lang.Class<? extends T> |
forName(java.lang.String className,
java.lang.Class<T> xface)
Returns the
Class object object associated with the class or interface
with the given string name, which is a subclass of xface. |
static java.lang.Class<?> |
getClass(org.apache.commons.configuration.Configuration conf,
java.lang.String name,
java.lang.Class<?> defaultCls,
java.lang.ClassLoader classLoader)
Get the value of the
name property as a Class. |
static <T> java.lang.Class<? extends T> |
getClass(org.apache.commons.configuration.Configuration conf,
java.lang.String name,
java.lang.Class<? extends T> defaultValue,
java.lang.Class<T> xface,
java.lang.ClassLoader classLoader)
Get the value of the
name property as a Class implementing
the interface specified by xface. |
static <T> T |
newInstance(java.lang.Class<T> theCls)
Create an object for the given class.
|
static <T> T |
newInstance(java.lang.String clsName,
java.lang.Class<T> xface)
Create an object using the given class name.
|
public static <T> java.lang.Class<? extends T> forName(java.lang.String className,
java.lang.Class<T> xface)
Class object object associated with the class or interface
with the given string name, which is a subclass of xface.className - class namexface - class interfacepublic static java.lang.Class<?> getClass(org.apache.commons.configuration.Configuration conf,
java.lang.String name,
java.lang.Class<?> defaultCls,
java.lang.ClassLoader classLoader)
throws org.apache.commons.configuration.ConfigurationException
name property as a Class.
If no such property is specified, then defaultCls is returned.conf - Configuration Object.name - Class Property Name.defaultCls - Default Class to be returned.classLoader - Class Loader to load class.Class, or defaultCls.org.apache.commons.configuration.ConfigurationExceptionpublic static <T> java.lang.Class<? extends T> getClass(org.apache.commons.configuration.Configuration conf,
java.lang.String name,
java.lang.Class<? extends T> defaultValue,
java.lang.Class<T> xface,
java.lang.ClassLoader classLoader)
throws org.apache.commons.configuration.ConfigurationException
name property as a Class implementing
the interface specified by xface.
If no such property is specified, then defaultValue is returned.
An exception is thrown if the returned class does not implement the named interface.
conf - Configuration Object.name - Class Property Name.defaultValue - Default Class to be returned.xface - The interface implemented by the named class.classLoader - Class Loader to load class.Class, or defaultValue.org.apache.commons.configuration.ConfigurationExceptionpublic static <T> T newInstance(java.lang.Class<T> theCls)
theCls - class of which an object is created.public static <T> T newInstance(java.lang.String clsName,
java.lang.Class<T> xface)
clsName - class name of which an object is created.xface - The interface implemented by the named class.Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.