Package org.jboss.shrinkwrap.api
Class SecurityActions
java.lang.Object
org.jboss.shrinkwrap.api.SecurityActions
A set of privileged actions that are not to leak out of this package
- Version:
- $Revision: $
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enumSingle instance to get the TCCL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static Constructor<?> getConstructor(Class<?> clazz, Class<?>... argumentTypes) Obtains the Constructor specified from the given Class and argument types(package private) static ClassLoaderObtains the Thread Context ClassLoader(package private) static <T> TnewInstance(Class<?> clazz, Class<?>[] argumentTypes, Object[] arguments, Class<T> expectedType) Creates a new instance of the specifiedClassusing the specified construction arguments.(package private) static <T> TnewInstance(String className, Class<?>[] argumentTypes, Object[] arguments, Class<T> expectedType, ClassLoader cl) Create a new instance by finding a constructor that matches the argumentTypes signature using the arguments for instantiation.
-
Constructor Details
-
SecurityActions
private SecurityActions()No instantiation
-
-
Method Details
-
getThreadContextClassLoader
Obtains the Thread Context ClassLoader -
getConstructor
static Constructor<?> getConstructor(Class<?> clazz, Class<?>... argumentTypes) throws NoSuchMethodException Obtains the Constructor specified from the given Class and argument types- Parameters:
clazz-argumentTypes-- Returns:
- Throws:
NoSuchMethodException
-
newInstance
static <T> T newInstance(Class<?> clazz, Class<?>[] argumentTypes, Object[] arguments, Class<T> expectedType) Creates a new instance of the specifiedClassusing the specified construction arguments. Casts and returns as the specified expected type- Type Parameters:
T-- Parameters:
clazz-argumentTypes-arguments-expectedType-- Returns:
-
newInstance
static <T> T newInstance(String className, Class<?>[] argumentTypes, Object[] arguments, Class<T> expectedType, ClassLoader cl) Create a new instance by finding a constructor that matches the argumentTypes signature using the arguments for instantiation.- Parameters:
className- Full classname of class to createargumentTypes- The constructor argument typesarguments- The constructor argumentscl- The ClassLoader to use in constructing the new instance- Returns:
- a new instance
- Throws:
IllegalArgumentException- if className, argumentTypes, ClassLoader, or arguments are nullRuntimeException- if any exceptions during creation
-