java.lang.reflect.Constructor< T > Class Reference

Inheritance diagram for java.lang.reflect.Constructor< T >:

java.lang.reflect.AccessibleObject

List of all members.


Detailed Description

This class must be implemented by the VM vendor.

This class models a constructor. Information about the constructor can be accessed, and the constructor can be invoked dynamically.

Public Member Functions

TypeVariable< Constructor< T > >[] getTypeParameters ()
String toGenericString ()
Type[] getGenericParameterTypes ()
Type[] getGenericExceptionTypes ()
Annotation[][] getParameterAnnotations ()
boolean isVarArgs ()
boolean isSynthetic ()
boolean equals (Object object)
 Compares the specified object to this Constructor and answer if they are equal.
Class< T > getDeclaringClass ()
 Return the Class associated with the class that defined this constructor.
Class<?>[] getExceptionTypes ()
 Return an array of the Class objects associated with the exceptions declared to be thrown by this constructor.
int getModifiers ()
 Return the modifiers for the modeled constructor.
String getName ()
 Return the name of the modeled constructor.
Class<?>[] getParameterTypes ()
 Return an array of the Class objects associated with the parameter types of this constructor.
int hashCode ()
 Answers an integer hash code for the receiver.
newInstance (Object...args) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
 Return a new instance of the declaring class, initialized by dynamically invoking the modeled constructor.
String toString ()
 Answers a string containing a concise, human-readable description of the receiver.

Private Member Functions

 Constructor ()
 Prevent this class from being instantiated.


Constructor & Destructor Documentation

java.lang.reflect.Constructor< T >.Constructor (  )  [private]

Prevent this class from being instantiated.


Member Function Documentation

String java.lang.reflect.Constructor< T >.toGenericString (  ) 

Returns the String representation of the constructor's declaration, including the type parameters.

Returns:
An instance of String.
Since:
1.5

Type [] java.lang.reflect.Constructor< T >.getGenericParameterTypes (  ) 

Gets the parameter types as an array of Type instances, in declaration order. If the constructor has no parameters, then an empty array is returned.

Returns:
An array of Type instances.
Exceptions:
GenericSignatureFormatError if the generic method signature is invalid.
TypeNotPresentException if the component type points to a missing type.
MalformedParameterizedTypeException if the component type points to a type that can't be instantiated for some reason.
Since:
1.5

Type [] java.lang.reflect.Constructor< T >.getGenericExceptionTypes (  ) 

Gets the exception types as an array of Type instances. If the constructor has no declared exceptions, then an empty array is returned.

Returns:
An array of Type instances.
Exceptions:
GenericSignatureFormatError if the generic method signature is invalid.
TypeNotPresentException if the component type points to a missing type.
MalformedParameterizedTypeException if the component type points to a type that can't be instantiated for some reason.
Since:
1.5

Annotation [][] java.lang.reflect.Constructor< T >.getParameterAnnotations (  ) 

Gets an array of arrays that represent the annotations of the formal parameters of this constructor. If there are no parameters on this constructor, then an empty array is returned. If there are no annotations set, then and array of empty arrays is returned.

Returns:
An array of arrays of Annotation instances.
Since:
1.5

boolean java.lang.reflect.Constructor< T >.isVarArgs (  ) 

Indicates whether or not this constructor takes a variable number argument.

Returns:
A value of true if a vararg is declare, otherwise false.
Since:
1.5

boolean java.lang.reflect.Constructor< T >.equals ( Object  object  ) 

Compares the specified object to this Constructor and answer if they are equal.

The object must be an instance of Constructor with the same defining class and parameter types.

Parameters:
object the object to compare
Returns:
true if the specified object is equal to this Constructor, false otherwise
See also:
hashCode

Class<T> java.lang.reflect.Constructor< T >.getDeclaringClass (  ) 

Return the Class associated with the class that defined this constructor.

Returns:
the declaring class

Class<?> [] java.lang.reflect.Constructor< T >.getExceptionTypes (  ) 

Return an array of the Class objects associated with the exceptions declared to be thrown by this constructor.

If the constructor was not declared to throw any exceptions, the array returned will be empty.

Returns:
the declared exception classes

int java.lang.reflect.Constructor< T >.getModifiers (  ) 

Return the modifiers for the modeled constructor.

The Modifier class should be used to decode the result.

Returns:
the modifiers
See also:
java.lang.reflect.Modifier

Reimplemented from java.lang.reflect.AccessibleObject.

String java.lang.reflect.Constructor< T >.getName (  ) 

Return the name of the modeled constructor.

This is the name of the declaring class.

Returns:
the name

Class<?> [] java.lang.reflect.Constructor< T >.getParameterTypes (  ) 

Return an array of the Class objects associated with the parameter types of this constructor.

If the constructor was declared with no parameters, the array returned will be empty.

Returns:
the parameter types

int java.lang.reflect.Constructor< T >.hashCode (  ) 

Answers an integer hash code for the receiver.

Objects which are equal answer the same value for this method. The hash code for a Constructor is the hash code of the declaring class' name.

Returns:
the receiver's hash
See also:
equals

T java.lang.reflect.Constructor< T >.newInstance ( Object...  args  )  throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException

Return a new instance of the declaring class, initialized by dynamically invoking the modeled constructor.

This reproduces the effect of new declaringClass(arg1, arg2, ... , argN) This method performs the following:

Parameters:
args the arguments to the constructor
Returns:
the new, initialized, object
Exceptions:
java.lang.InstantiationException if the class cannot be instantiated
java.lang.IllegalAccessException if the modeled constructor is not accessible
java.lang.IllegalArgumentException if an incorrect number of arguments are passed, or an argument could not be converted by a widening conversion
java.lang.reflect.InvocationTargetException if an exception was thrown by the invoked constructor
See also:
java.lang.reflect.AccessibleObject

String java.lang.reflect.Constructor< T >.toString (  ) 

Answers a string containing a concise, human-readable description of the receiver.

The format of the string is modifiers (if any) declaring class name '(' parameter types, separated by ',' ')' If the constructor throws exceptions, ' throws ' exception types, separated by ',' For example: public String(byte[],String) throws UnsupportedEncodingException

Returns:
a printable representation for the receiver


The documentation for this class was generated from the following file:

Genereated on Tue Dec 9 14:09:48 2008 by Doxygen.

(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.