1 |
/* java.lang.reflect.Constructor - reflection of Java constructors |
/* java.lang.reflect.Constructor - reflection of Java constructors |
2 |
Copyright (C) 1998, 2001 Free Software Foundation, Inc. |
Copyright (C) 1998, 2001, 2004 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
73 |
* @since 1.1 |
* @since 1.1 |
74 |
* @status updated to 1.4 |
* @status updated to 1.4 |
75 |
*/ |
*/ |
76 |
public final class Constructor |
public final class Constructor<T> |
77 |
extends AccessibleObject implements Member |
extends AccessibleObject |
78 |
|
implements GenericDeclaration, Member |
79 |
{ |
{ |
80 |
private Class clazz; |
private Class<T> clazz; |
81 |
private int slot; |
private int slot; |
82 |
private Class[] parameterTypes; |
private Class[] parameterTypes; |
83 |
private Class[] exceptionTypes; |
private Class[] exceptionTypes; |
99 |
* Gets the class that declared this constructor. |
* Gets the class that declared this constructor. |
100 |
* @return the class that declared this member |
* @return the class that declared this member |
101 |
*/ |
*/ |
102 |
public Class getDeclaringClass() |
public Class<T> getDeclaringClass() |
103 |
{ |
{ |
104 |
return clazz; |
return clazz; |
105 |
} |
} |
130 |
* |
* |
131 |
* @return a list of the types of the constructor's parameters |
* @return a list of the types of the constructor's parameters |
132 |
*/ |
*/ |
133 |
public Class[] getParameterTypes() |
public Class<?>[] getParameterTypes() |
134 |
{ |
{ |
135 |
if (parameterTypes == null) |
if (parameterTypes == null) |
136 |
return new Class[0]; |
return new Class[0]; |
144 |
* |
* |
145 |
* @return a list of the types in the constructor's throws clause |
* @return a list of the types in the constructor's throws clause |
146 |
*/ |
*/ |
147 |
public Class[] getExceptionTypes() |
public Class<?>[] getExceptionTypes() |
148 |
{ |
{ |
149 |
if (exceptionTypes == null) |
if (exceptionTypes == null) |
150 |
return new Class[0]; |
return new Class[0]; |
248 |
* @throws ExceptionInInitializerError if construction triggered class |
* @throws ExceptionInInitializerError if construction triggered class |
249 |
* initialization, which then failed |
* initialization, which then failed |
250 |
*/ |
*/ |
251 |
public Object newInstance(Object args[]) |
public T newInstance(Object args[]) |
252 |
throws InstantiationException, IllegalAccessException, |
throws InstantiationException, IllegalAccessException, |
253 |
InvocationTargetException |
InvocationTargetException |
254 |
{ |
{ |
255 |
return constructNative(args, clazz, slot); |
return constructNative(args, clazz, slot); |
256 |
} |
} |
257 |
|
|
258 |
private native Object constructNative(Object[] args, Class declaringClass, |
private native T constructNative(Object[] args, Class declaringClass, |
259 |
int slot) |
int slot) |
260 |
throws InstantiationException, IllegalAccessException, |
throws InstantiationException, IllegalAccessException, |
261 |
InvocationTargetException; |
InvocationTargetException; |
262 |
} |
} |