aicas logoJamaica 3.2 release 62

java.lang.reflect
Class Constructor<T>

java.lang.Object
  extended by java.lang.reflect.AccessibleObject
      extended by java.lang.reflect.Constructor<T>
All Implemented Interfaces:
AnnotatedElement, GenericDeclaration, Member

public final class Constructor<T>
extends AccessibleObject
implements AnnotatedElement, GenericDeclaration, Member

Constructor enables reflection access to Java constructors.


Field Summary
 
Fields inherited from interface java.lang.reflect.Member
DECLARED, PUBLIC
 
Method Summary
 boolean equals(Object obj)
          equals compares two constructors.
<T extends Annotation>
T
getAnnotation(Class<T> annotationClass)
          getAnnotation NYI: COMMENT: JDK 1.5 method description
 Annotation[] getDeclaredAnnotations()
          getDeclaredAnnotations NYI: COMMENT: JDK 1.5 method description
 Class<T> getDeclaringClass()
          getDeclaringClass returns the class this constructor was declared in.
 Class<?>[] getExceptionTypes()
          getExceptionTypes returns an array of all declared exceptions of this constructor.
 Type[] getGenericExceptionTypes()
          getGenericExceptionTypes NYI: COMMENT: JDK 1.5 method description
 Type[] getGenericParameterTypes()
          getGenericParameterTypes NYI: COMMENT: JDK 1.5 method description
 int getModifiers()
          getModifiers returns the set of modifiers set for this constructor.
 String getName()
          getName returns the name of this constructor.
 Annotation[][] getParameterAnnotations()
          getParameterAnnotations NYI: COMMENT: JDK 1.5 method description
 Class<?>[] getParameterTypes()
          getParameterTypes returns an array with the type of all the parameters of this constructor.
 TypeVariable<Constructor<T>>[] getTypeParameters()
          getTypeParameters NYI: COMMENT: JDK 1.5 method description
 int hashCode()
          hashCode returns a hash code for this constructor.
 boolean isSynthetic()
          isSynthetic NYI: COMMENT: JDK 1.5 method description
 boolean isVarArgs()
          isVarArgs NYI: COMMENT: JDK 1.5 method description
 T newInstance(Object... initargs)
          newInstance creates a new instance of this constructor's declaring class and executed this constructors.
 String toGenericString()
          toGenericString NYI: COMMENT: JDK 1.5 method description
 String toString()
          toString conversts this constructor to a string such as "public java.lang.Integer(int)"
 
Methods inherited from class java.lang.reflect.AccessibleObject
getAnnotations, isAccessible, isAnnotationPresent, setAccessible, setAccessible
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.reflect.AnnotatedElement
getAnnotations, isAnnotationPresent
 

Method Detail

getDeclaringClass

public Class<T> getDeclaringClass()
getDeclaringClass returns the class this constructor was declared in.

Specified by:
getDeclaringClass in interface Member
Returns:
The class declaring this constructor.
See Also:
Member.getDeclaringClass()

getModifiers

public int getModifiers()
getModifiers returns the set of modifiers set for this constructor.

Specified by:
getModifiers in interface Member
Returns:
the modifiers.
See Also:
Modifier

getParameterTypes

public Class<?>[] getParameterTypes()
getParameterTypes returns an array with the type of all the parameters of this constructor.

Returns:
an array of all parameters of this constructor.

getName

public String getName()
getName returns the name of this constructor.

Specified by:
getName in interface Member
Returns:
the name as a new java string.

getExceptionTypes

public Class<?>[] getExceptionTypes()
getExceptionTypes returns an array of all declared exceptions of this constructor.

Returns:
array of declared exceptions, never null.

equals

public boolean equals(Object obj)
equals compares two constructors.

Overrides:
equals in class Object
Parameters:
obj - another constructor
Returns:
true iff obj is a constructor with the same declaringClass() as this and equal getParameterTypes() arrays.

hashCode

public int hashCode()
hashCode returns a hash code for this constructor.

Overrides:
hashCode in class Object
Returns:
getDeclaringClass().getName().hashCode();

toString

public String toString()
toString conversts this constructor to a string such as "public java.lang.Integer(int)"

Overrides:
toString in class Object
Returns:
a string representation of this.

newInstance

public T newInstance(Object... initargs)
              throws InstantiationException,
                     IllegalAccessException,
                     IllegalArgumentException,
                     InvocationTargetException
newInstance creates a new instance of this constructor's declaring class and executed this constructors. Before the constructor is executed, it is ensured that the declaring class is initialized.

Parameters:
initargs - the arguments to be passed to this constructor. This may be null if getParameterTypes().length==0.
Returns:
the newly created and initialized instance
Throws:
InstantiationException - if the declaring class is abstract.
IllegalAccessException - if the caller is not permitted to call this construcctor.
IllegalArgumentException - if initargs are not compatible to this constructor's arguments lists.
InvocationTargetException - if execution of the constructor resulted in an exception.
ExceptionInInitializerError - if intialization of the declaring class or any other class whose initialization was triggered by initializing the declaring class or by execution of this constructor failed.

getTypeParameters

public TypeVariable<Constructor<T>>[] getTypeParameters()
getTypeParameters

NYI: COMMENT: JDK 1.5 method description

Specified by:
getTypeParameters in interface GenericDeclaration
Returns:
an array of TypeVariable objects that represent the type variables declared by this generic declaration
Since:
1.5

getGenericParameterTypes

public Type[] getGenericParameterTypes()
getGenericParameterTypes

NYI: COMMENT: JDK 1.5 method description

Returns:
an array of Types that represent the formal parameter types of the underlying method, in declaration order
Since:
1.5

getGenericExceptionTypes

public Type[] getGenericExceptionTypes()
getGenericExceptionTypes

NYI: COMMENT: JDK 1.5 method description

Returns:
an array of Types that represent the exception types thrown by the underlying method
Since:
1.5

toGenericString

public String toGenericString()
toGenericString

NYI: COMMENT: JDK 1.5 method description

Returns:
a string describing this Constructor, include type parameters
Since:
1.5

isVarArgs

public boolean isVarArgs()
isVarArgs

NYI: COMMENT: JDK 1.5 method description

Returns:
true if an only if this constructor was declared to take a variable number of arguments.
Since:
1.5

isSynthetic

public boolean isSynthetic()
isSynthetic

NYI: COMMENT: JDK 1.5 method description

Specified by:
isSynthetic in interface Member
Returns:
true if and only if this constructor is a synthetic constructor as defined by the Java Language Specification.
Since:
1.5

getAnnotation

public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
getAnnotation

NYI: COMMENT: JDK 1.5 method description

Specified by:
getAnnotation in interface AnnotatedElement
Overrides:
getAnnotation in class AccessibleObject
Parameters:
annotationClass -
Returns:
this element's annotation for the specified annotation type if present on this element, else null
Since:
1.5

getDeclaredAnnotations

public Annotation[] getDeclaredAnnotations()
getDeclaredAnnotations

NYI: COMMENT: JDK 1.5 method description

Specified by:
getDeclaredAnnotations in interface AnnotatedElement
Overrides:
getDeclaredAnnotations in class AccessibleObject
Returns:
All annotations directly present on this element
Since:
1.5

getParameterAnnotations

public Annotation[][] getParameterAnnotations()
getParameterAnnotations

NYI: COMMENT: JDK 1.5 method description

Returns:
an array of arrays that represent the annotations on the formal parameters, in declaration order, the method represented by this Method object
Since:
1.5

aicas logoJamaica 3.2 release 62

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2008 aicas GmbH. All Rights Reserved.