public class Constructors extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> Constructor<T> |
getConstructorOptional(Class<T> type,
Class<?>... parameterTypes)
|
static List<Constructor<?>> |
getConstructorsOptional(Class<?> type)
Delegates to
Class.getConstructors(), and returns the result
as an unmodifiable list. |
static List<Constructor<?>> |
getConstructorsUnchecked(Class<?> type)
Delegates to
Class.getConstructors(), and returns the result
as an unmodifiable list. |
static <T> Constructor<T> |
getConstructorUnchecked(Class<T> type,
Class<?>... parameterTypes)
|
static <T> Constructor<T> |
getDeclaredConstructorOptional(Class<T> type,
Class<?>... parameterTypes)
|
static List<Constructor<?>> |
getDeclaredConstructorsOptional(Class<?> type)
Delegates to
Class.getDeclaredConstructors(), and returns the
result as an unmodifiable list. |
static List<Constructor<?>> |
getDeclaredConstructorsUnchecked(Class<?> type)
Delegates to
Class.getDeclaredConstructors(), and returns the
result as an unmodifiable list. |
static <T> Constructor<T> |
getDeclaredConstructorUnchecked(Class<T> type,
Class<?>... parameterTypes)
|
static <T> T |
newInstanceNonAccessibleOptional(Constructor<T> constructor,
Object... arguments)
Delegates to
Constructor.newInstance(Object...). |
static <T> T |
newInstanceNonAccessibleUnchecked(Constructor<T> constructor,
Object... arguments)
Delegates to
Constructor.newInstance(Object...). |
static <T> T |
newInstanceOptional(Constructor<T> constructor,
Object... arguments)
Delegates to
Constructor.newInstance(Object...). |
static <T> T |
newInstanceUnchecked(Constructor<T> constructor,
Object... arguments)
Delegates to
Constructor.newInstance(Object...). |
static Constructor<?> |
parseConstructorUnchecked(String fullConstructorString)
Parse the constructor from the given string.
|
public static Constructor<?> parseConstructorUnchecked(String fullConstructorString)
Constructor.toString() or Constructor.toGenericString().fullConstructorString - The full constructor stringReflectionException - If the constructor can not be parsed
for any reason. Either because the declaring class or any parameter
class can not be found, or because the constructor is not found, or
because the input string is otherwise invalid.public static <T> T newInstanceUnchecked(Constructor<T> constructor, Object... arguments)
Constructor.newInstance(Object...).ReflectionExceptionT - The type of the constructorconstructor - The constructorarguments - The argumentsReflectionException - if the call did not succeedpublic static <T> T newInstanceOptional(Constructor<T> constructor, Object... arguments)
T - The type of the constructorconstructor - The constructorarguments - The argumentsReflectionException - if the call did not succeedpublic static <T> T newInstanceNonAccessibleUnchecked(Constructor<T> constructor, Object... arguments)
Constructor.newInstance(Object...).ReflectionExceptionT - The type of the constructorconstructor - The constructorarguments - The argumentsReflectionException - if the call did not succeedpublic static <T> T newInstanceNonAccessibleOptional(Constructor<T> constructor, Object... arguments)
Constructor.newInstance(Object...).null if the call did not succeed.T - The type of the constructorconstructor - The constructorarguments - The argumentspublic static <T> Constructor<T> getConstructorUnchecked(Class<T> type, Class<?>... parameterTypes)
Class.getConstructor(Class...).ReflectionExceptionT - The typetype - The typeparameterTypes - The parameter typesReflectionException - if the call did not succeedpublic static <T> Constructor<T> getConstructorOptional(Class<T> type, Class<?>... parameterTypes)
Class.getConstructor(Class...).null if the call did not succeed.T - The typetype - The typeparameterTypes - The parameter typesnullpublic static List<Constructor<?>> getConstructorsUnchecked(Class<?> type)
Class.getConstructors(), and returns the result
as an unmodifiable list.ReflectionExceptiontype - The typeReflectionException - if the call did not succeedpublic static List<Constructor<?>> getConstructorsOptional(Class<?> type)
Class.getConstructors(), and returns the result
as an unmodifiable list.type - The typepublic static <T> Constructor<T> getDeclaredConstructorUnchecked(Class<T> type, Class<?>... parameterTypes)
Class.getDeclaredConstructor(Class...).ReflectionExceptionT - The typetype - The typeparameterTypes - The parameter typesReflectionException - if the call did not succeedpublic static <T> Constructor<T> getDeclaredConstructorOptional(Class<T> type, Class<?>... parameterTypes)
Class.getDeclaredConstructor(Class...).null if the call did not succeed.T - The typetype - The typeparameterTypes - The parameter typesnullpublic static List<Constructor<?>> getDeclaredConstructorsUnchecked(Class<?> type)
Class.getDeclaredConstructors(), and returns the
result as an unmodifiable list.ReflectionExceptiontype - The typeReflectionException - if the call did not succeedpublic static List<Constructor<?>> getDeclaredConstructorsOptional(Class<?> type)
Class.getDeclaredConstructors(), and returns the
result as an unmodifiable list.type - The typeCopyright © 2018. All rights reserved.