package java.lang.reflect;
public final class Constructor extends AccessibleObject implements Member
{
public boolean equals (Object obj)
{
if (! (obj instanceof Constructor))
return false;
Constructor c = (Constructor) obj;
return declaringClass == c.declaringClass && offset == c.offset;
}
public Class getDeclaringClass ()
{
return declaringClass;
}
public Class[] getExceptionTypes ()
{
if (exception_types == null)
getType();
return (Class[]) exception_types.clone();
}
public native int getModifiers ();
public String getName ()
{
return declaringClass.getName();
}
public Class[] getParameterTypes ()
{
if (parameter_types == null)
getType ();
return (Class[]) parameter_types.clone();
}
public int hashCode ()
{
return getName().hashCode() + declaringClass.getName().hashCode();
}
private native void getType ();
public native Object newInstance (Object[] args)
throws InstantiationException, IllegalAccessException,
IllegalArgumentException, InvocationTargetException;
public String toString ()
{
if (parameter_types == null)
getType ();
StringBuffer b = new StringBuffer ();
Modifier.toString(getModifiers(), b);
b.append(" ");
Method.appendClassName (b, declaringClass);
b.append("(");
for (int i = 0; i < parameter_types.length; ++i)
{
Method.appendClassName (b, parameter_types[i]);
if (i < parameter_types.length - 1)
b.append(",");
}
b.append(")");
return b.toString();
}
private Constructor ()
{
}
private Class declaringClass;
private Class[] exception_types;
private Class[] parameter_types;
private int offset;
}