public final class Loader extends Object
Modifier and Type | Method and Description |
---|---|
static Class<?> |
getClass(String name)
Returns the
Class object associated with the class or interface with the given
name, or null if the class could not be returned for any reason. |
static ClassLoader |
getClassLoader()
Returns the class loader that should be used consistently throughout the application.
|
static URL |
getResource(String name)
Finds the resource with the given name.
|
static <E> List<E> |
loadList(Class<E> serviceType)
Loads services of a particular type into a list.
|
static <K,V extends Indexed<K>> |
loadMap(Class<K> keyType,
Class<V> serviceType)
Loads services of a particular type into a map.
|
static Object |
newInstance(String name)
Creates a new instance of a named class.
|
static <T> T |
newInstance(String name,
Class<T> type)
Creates a new instance of a named class.
|
public static ClassLoader getClassLoader()
public static Class<?> getClass(String name)
Class
object associated with the class or interface with the given
name, or null
if the class could not be returned for any reason.name
- the fully qualified name of the desired class.public static Object newInstance(String name)
new
expression with an empty argument list. If the class cannot be instantiated
for any reason, null
is returned.name
- the fully qualified name of the class to instantiate.null
if it could not be instantiated.public static <T> T newInstance(String name, Class<T> type)
new
expression with an empty argument list. If the class cannot be instantiated
for any reason, null
is returned.T
- class typename
- the fully qualified name of the class to instantiate.type
- the class of the type of object to instantiate.null
if it could not be instantiated.public static <K,V extends Indexed<K>> Map<K,V> loadMap(Class<K> keyType, Class<V> serviceType)
Indexed
interface to provide a key to index the service by in the map.K
- key typeV
- service typekeyType
- the class type of the key to be indexed in the map.serviceType
- the class type of services to load.public static <E> List<E> loadList(Class<E> serviceType)
E
- service typeserviceType
- the class type of services to load.public static URL getResource(String name)
name
- the resource name.URL
object for reading the resource, or null
if the resource could not be found.ClassLoader.getResource(java.lang.String)
Copyright © 2010-2018, ForgeRock All Rights Reserved.