JMMF API
pre-release v0.7

fr.umlv.jmmf.reflect
Class MultiConstructor

java.lang.Object
  |
  +--java.lang.reflect.AccessibleObject
        |
        +--fr.umlv.jmmf.reflect.MultiConstructor
All Implemented Interfaces:
java.lang.reflect.Member

public final class MultiConstructor
extends java.lang.reflect.AccessibleObject
implements java.lang.reflect.Member

The multi-constructor object.

Version:
0.7.5
Author:
Remi Forax
See Also:
MultiMethod

Field Summary
static java.lang.Class NULL_CLASS
          special class for null value.
 
Fields inherited from interface java.lang.reflect.Member
DECLARED, PUBLIC
 
Method Summary
static MultiConstructor create(java.lang.Class clazz, int argLength)
          construct a multi-constructor by taking all constructors with argLength parameter(s) in class clazz.
 java.lang.Class getDeclaringClass()
          return class that contains all methods of the current multi-method.
 java.lang.Class[] getExceptionTypes()
          return the exception types of the current method.
 int getModifiers()
          returns the Java language modifiers for the multi-method represented by this MultiMethod object, as an integer.
 java.lang.String getName()
          return the name of the current multi-method.
 java.lang.Class[] getParameterTypes()
          return the parameter types of the current method. a parameter type is the lowest common subtype of all parameter types of the methods that composed the multi-method.
 int hashCode()
          Returns a hashcode for this MultiConstructor.
 java.lang.Object newInstance(java.lang.Object[] args)
          call the best constructor of the multi-constructor according to the type of all items in array args.
 java.lang.Object newInstance(java.lang.Object[] args, java.lang.Class[] types)
          call the best constructor of the multi-constructor according to the type of array types.
 java.lang.String toString()
          return a string representation of the multi-method.
 
Methods inherited from class java.lang.reflect.AccessibleObject
isAccessible, setAccessible, setAccessible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_CLASS

public static final java.lang.Class NULL_CLASS
special class for null value.
Method Detail

hashCode

public int hashCode()
Returns a hashcode for this MultiConstructor. The hashcode is computed as the exclusive-or of the hashcodes for the underlying method's declaring class name and the method's name.
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
return a string representation of the multi-method.
Overrides:
toString in class java.lang.Object

newInstance

public java.lang.Object newInstance(java.lang.Object[] args)
                             throws java.lang.InstantiationException,
                                    java.lang.IllegalAccessException,
                                    java.lang.reflect.InvocationTargetException,
                                    java.lang.NoSuchMethodException,
                                    MultipleMethodsException
call the best constructor of the multi-constructor according to the type of all items in array args.
Parameters:
args - arguments of the multi-method,

newInstance

public java.lang.Object newInstance(java.lang.Object[] args,
                                    java.lang.Class[] types)
                             throws java.lang.InstantiationException,
                                    java.lang.IllegalAccessException,
                                    java.lang.reflect.InvocationTargetException,
                                    java.lang.NoSuchMethodException,
                                    MultipleMethodsException
call the best constructor of the multi-constructor according to the type of array types.
Parameters:
args - arguments of the multi-method,
types - the best method of the multi-method is called according to this types.

getModifiers

public int getModifiers()
returns the Java language modifiers for the multi-method represented by this MultiMethod object, as an integer. The Modifier class should be used to decode the modifiers.
Specified by:
getModifiers in interface java.lang.reflect.Member
See Also:
java.lang.reflect.Modifier

getName

public java.lang.String getName()
return the name of the current multi-method.
Specified by:
getName in interface java.lang.reflect.Member

getDeclaringClass

public java.lang.Class getDeclaringClass()
return class that contains all methods of the current multi-method.
Specified by:
getDeclaringClass in interface java.lang.reflect.Member
See Also:
Method.getDeclaringClass()

getParameterTypes

public java.lang.Class[] getParameterTypes()
return the parameter types of the current method. a parameter type is the lowest common subtype of all parameter types of the methods that composed the multi-method.
Returns:
an array of class that contains all parameter types of the current multi-method.
See Also:
Method.getParameterTypes()

getExceptionTypes

public java.lang.Class[] getExceptionTypes()
return the exception types of the current method. The exception types is the union of all exception types of all methods.
Returns:
an array of class that contains all exception types of the current multi-method.
See Also:
Method.getExceptionTypes()

create

public static MultiConstructor create(java.lang.Class clazz,
                                      int argLength)
construct a multi-constructor by taking all constructors with argLength parameter(s) in class clazz.
Parameters:
clazz - class which owns the constructors.
argLenth - number of parameters.
Throws:
java.lang.IllegalArgumentException - if the class clazz contains no constructor with argLength parameter.
See Also:
MultiFactory, MultiFactory.create(Class,int)

JMMF API
pre-release v0.7

Rémi Forax 1999,2000 Université de Marne la Vallée