public class Utils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Utils.ClassRef |
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static Utils.ClassRef |
getClassRef(String classRef)
Get a class proxy reference for the given class reference
|
static Utils.ClassRef |
getClassRef(String classRef,
org.osgi.framework.Bundle bundle) |
static Class<?> |
loadClass(String classRef)
Load a class from a class reference string.
|
static Class<?> |
loadClass(String bundleId,
String className)
Load a class given the owner bundle and the class name.
|
static Class<?>[] |
loadClasses(String classRefs)
Load classes from a list of class references given as a comma separated string list.
|
static Class<?>[] |
loadClasses(String classRefs,
char sep)
Load classes from a list of class references given as a 'sep' separated string list.
|
static Object |
newInstance(String classRef)
Create a new object of the given a class reference.
|
static Object |
newInstance(String bundleId,
String className)
Create a new object of the given class in the given bundle.
|
static <T> T[] |
newInstances(Class<T> componentType,
String classRefs)
Get class instances for the given class references string
|
static <T> T[] |
newInstances(Class<T> componentType,
String classRefs,
char sep)
Get class instances for the given class references string
|
public Utils()
public static Class<?>[] loadClasses(String classRefs) throws ClassNotFoundException, BundleNotFoundException
classRefs
- the string containing the list of class referencesClassNotFoundException
BundleNotFoundException
public static Class<?>[] loadClasses(String classRefs, char sep) throws ClassNotFoundException, BundleNotFoundException
classRefs
- the string containing the list of class referencessep
- the separator character used to separate class references in the string.ClassNotFoundException
BundleNotFoundException
public static <T> T[] newInstances(Class<T> componentType, String classRefs) throws ReflectiveOperationException, BundleNotFoundException
T
- componentType
- the type of the expected array componentclassRefs
- ReflectiveOperationException
BundleNotFoundException
#loadClasses(String)}
public static <T> T[] newInstances(Class<T> componentType, String classRefs, char sep) throws ReflectiveOperationException, BundleNotFoundException
T
- componentType
- classRefs
- sep
- ReflectiveOperationException
BundleNotFoundException
#loadClasses(String, char)}
public static Class<?> loadClass(String classRef) throws ClassNotFoundException, BundleNotFoundException
bundleSymbolicName:className
or className
. If no bundle symbolic name is given the
class will be loaded using the class loader of the Utils
class.
The bundle will be resolved to the last version of the bundle (in case when different bundle versions are found)
classRef
- ClassNotFoundException
BundleNotFoundException
public static Utils.ClassRef getClassRef(String classRef) throws ClassNotFoundException, BundleNotFoundException
classRef
- ClassNotFoundException
BundleNotFoundException
public static Utils.ClassRef getClassRef(String classRef, org.osgi.framework.Bundle bundle) throws ClassNotFoundException, BundleNotFoundException
public static Class<?> loadClass(String bundleId, String className) throws ClassNotFoundException, BundleNotFoundException
The bundle will be resolved to the last version of the bundle (in case when different bundle versions are found)
bundleId
- className
- ClassNotFoundException
BundleNotFoundException
public static Object newInstance(String bundleId, String className) throws ReflectiveOperationException, BundleNotFoundException
The bundle will be resolved to the last version of the bundle (in case when different bundle versions are found)
bundleId
- className
- ReflectiveOperationException
BundleNotFoundException
#loadClass(String, String)}
public static Object newInstance(String classRef) throws ReflectiveOperationException, BundleNotFoundException
The bundle will be resolved to the last version of the bundle (in case when different bundle versions are found)
classRef
- ReflectiveOperationException
BundleNotFoundException
#loadClass(String, String)}
Copyright © 2015 Nuxeo SA. All rights reserved.