mirror of https://github.com/apache/jclouds.git
Re-adding Reflection2.constructor
Removed in 671749d
but used downstream in jclouds-labs
This commit is contained in:
parent
c426e7ec24
commit
2a5928b55d
|
@ -71,6 +71,23 @@ public class Reflection2 {
|
|||
return (TypeToken<T>) get(typeTokenForClass, checkNotNull(in, "class"));
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an {@link Invokable} object that reflects a constructor present in the {@link TypeToken} type.
|
||||
*
|
||||
* @param ownerType
|
||||
* corresponds to {@link Invokable#getOwnerType()}
|
||||
* @param parameterTypes
|
||||
* corresponds to {@link Constructor#getParameterTypes()}
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if the constructor doesn't exist or a security exception occurred
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Invokable<T, T> constructor(Class<T> ownerType, Class<?>... parameterTypes) {
|
||||
return (Invokable<T, T>) get(constructorForParams, new TypeTokenAndParameterTypes(typeToken(ownerType),
|
||||
parameterTypes));
|
||||
}
|
||||
|
||||
/**
|
||||
* return all constructors present in the class as {@link Invokable}s.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue