DynamicJava Javadoc: Class ReflectionUtilities

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## koala.dynamicjava.util
Class ReflectionUtilities

    java.lang.Object
      |
      +--koala.dynamicjava.util.ReflectionUtilities

public class ReflectionUtilities
extends java.lang.Object

This class contains a collection of utility methods for reflection.

Constructor Summary
`protected` | `ReflectionUtilities()` This class contains only static methods, so it is not useful to create instances of it.

Method Summary
`static java.util.List` | `getConstructors(java.lang.Class cl, int params)` Gets all the constructors in the given class or super classes, even the redefined constructors are returned.
`static java.lang.reflect.Field` | `getField(java.lang.Class cl, java.lang.String name)` Returns a field with the given name declared in the given class or in the superclasses of the given class
`static java.util.List` | `getMethods(java.lang.Class cl, java.lang.String name, int params)` Gets all the methods with the given name in the given class or super classes.
`static java.lang.reflect.Field` | `getOuterField(java.lang.Class cl, java.lang.String name)` Returns a field with the given name declared in one of the outer classes of the given class
`static boolean` | `hasCompatibleSignatures(java.lang.Class[] a1, java.lang.Class[] a2)` For each element (class) of the given arrays, tests if the first array element is assignable from the second array element.
`static boolean` | `isCompatible(java.lang.Class c1, java.lang.Class c2)` Whether 'c1' is assignable from 'c2'
`static java.lang.reflect.Constructor` | `lookupConstructor(java.lang.Class cl, java.lang.Class[] ac)` Looks for a constructor in the given class or in super classes of this class.
`static java.lang.reflect.Method` | `lookupMethod(java.lang.Class cl, java.lang.String name, java.lang.Class[] ac)` Looks for a method in the given class or in super classes of this class.
`static java.lang.reflect.Method` | `lookupMethod(java.lang.Class cl, java.lang.String name, java.util.List ac)` Looks for a method in the given class or in super classes of this class.
`static java.lang.reflect.Method` | `lookupOuterMethod(java.lang.Class cl, java.lang.String name, java.lang.Class[] ac)` Looks up for a method in an outer classes of this class.
`protected static java.lang.reflect.Constructor` | `selectTheMostSpecificConstructor(java.lang.reflect.Constructor c1, java.lang.reflect.Constructor c2)` Returns the constructor with the most specific signature.
`protected static java.lang.reflect.Method` | `selectTheMostSpecificMethod(java.lang.reflect.Method m1, java.lang.reflect.Method m2)` Returns the method with the most specific signature.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ReflectionUtilities

    protected ReflectionUtilities()

  This class contains only static methods, so it is not useful to create instances of it.

Method Detail

### lookupConstructor

    public static java.lang.reflect.Constructor lookupConstructor(java.lang.Class cl,
                                                                  java.lang.Class[] ac)
                                                           throws java.lang.NoSuchMethodException

  Looks for a constructor in the given class or in super classes of this class.
  Parameters:
    `cl` - the class of which the constructor is a member
    `ac` - the arguments classes (possibly not the exact declaring classes)

### getConstructors

    public static java.util.List getConstructors(java.lang.Class cl,
                                                 int params)

  Gets all the constructors in the given class or super classes, even the redefined constructors are returned.
  Parameters:
    `cl` - the class where the constructor was declared
    `params` - the number of parameters
  Returns:
    a list that contains the found constructors, an empty list if no matching constructor was found.

### lookupMethod

    public static java.lang.reflect.Method lookupMethod(java.lang.Class cl,
                                                        java.lang.String name,
                                                        java.util.List ac)
                                                 throws java.lang.NoSuchMethodException

  Looks for a method in the given class or in super classes of this class.
  Parameters:
    `cl` - the class of which the method is a member
    `name` - the name of the method
    `ac` - the arguments classes (possibly not the exact declaring classes)

### lookupMethod

    public static java.lang.reflect.Method lookupMethod(java.lang.Class cl,
                                                        java.lang.String name,
                                                        java.lang.Class[] ac)
                                                 throws java.lang.NoSuchMethodException

  Looks for a method in the given class or in super classes of this class.
  Parameters:
    `cl` - the class of which the method is a member
    `name` - the name of the method
    `ac` - the arguments classes (possibly not the exact declaring classes)

### getMethods

    public static java.util.List getMethods(java.lang.Class cl,
                                            java.lang.String name,
                                            int params)

  Gets all the methods with the given name in the given class or super classes. Even the redefined methods are returned.
  Parameters:
    `cl` - the class where the method was declared
    `name` - the name of the method
    `params` - the number of parameters
  Returns:
    a list that contains the found methods, an empty list if no matching method was found.

### lookupOuterMethod

    public static java.lang.reflect.Method lookupOuterMethod(java.lang.Class cl,
                                                             java.lang.String name,
                                                             java.lang.Class[] ac)
                                                      throws java.lang.NoSuchMethodException

  Looks up for a method in an outer classes of this class.
  Parameters:
    `cl` - the inner class
    `name` - the name of the method
    `ac` - the arguments classes (possibly not the exact declaring classes)

### getField

    public static java.lang.reflect.Field getField(java.lang.Class cl,
                                                   java.lang.String name)
                                            throws java.lang.NoSuchFieldException,
                                                   AmbiguousFieldException

  Returns a field with the given name declared in the given class or in the superclasses of the given class
  Parameters:
    `cl` - the class where the field must look for the field
    `name` - the name of the field

### getOuterField

    public static java.lang.reflect.Field getOuterField(java.lang.Class cl,
                                                        java.lang.String name)
                                                 throws java.lang.NoSuchFieldException,
                                                        AmbiguousFieldException

  Returns a field with the given name declared in one of the outer classes of the given class
  Parameters:
    `cl` - the inner class
    `name` - the name of the field

### selectTheMostSpecificMethod

    protected static java.lang.reflect.Method selectTheMostSpecificMethod(java.lang.reflect.Method m1,
                                                                          java.lang.reflect.Method m2)

  Returns the method with the most specific signature. It is assumed that m1 and m2 have the same number of parameters.

### selectTheMostSpecificConstructor

    protected static java.lang.reflect.Constructor selectTheMostSpecificConstructor(java.lang.reflect.Constructor c1,
                                                                                    java.lang.reflect.Constructor c2)

  Returns the constructor with the most specific signature. It is assumed that m1 and m2 have the same number of parameters.

### hasCompatibleSignatures

    public static boolean hasCompatibleSignatures(java.lang.Class[] a1,
                                                  java.lang.Class[] a2)

  For each element (class) of the given arrays, tests if the first array element is assignable from the second array element. The two arrays are assumed to have the same length.

### isCompatible

    public static boolean isCompatible(java.lang.Class c1,
                                       java.lang.Class c2)

  Whether 'c1' is assignable from 'c2'

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001 Stephane Hillion. All Rights Reserved.