org.codehaus.aspectwerkz.reflect
Class ClassInfoHelper

java.lang.Object
  extended by org.codehaus.aspectwerkz.reflect.ClassInfoHelper

public class ClassInfoHelper
extends Object

Utility method for manipulating and managing ClassInfo hierarchies.

Author:
Jonas BonŽr , Alexandre Vasseur

Constructor Summary
ClassInfoHelper()
           
 
Method Summary
static List collectInterfaces(ClassInfo classInfo)
          Collects all the interface from the given class including the one from its super class.
static List collectMethodsFromInterface(ClassInfo interfaceClassInfo)
          Collects the methods from all the interface and its super interfaces.
static List collectMethodsFromInterfacesImplementedBy(ClassInfo classInfo)
          Collects the methods from all the interfaces of the class and its super interfaces.
static List createInterfaceDefinedMethodList(ClassInfo klass, List interfaceDeclaredMethods)
          Creates a method list of all the methods in the class and super classes, if and only if those are part of the given list of interfaces declared methods.
static List createMethodList(ClassInfo klass)
          Creates a method list of all the methods in the class and super classes, including package private ones.
static boolean extendsSuperClass(ClassInfo classInfo, String className)
          Checks if a class has a certain class as super class, somewhere up in the class hierarchy.
static boolean hasMethodClash(Set interfacesToAdd, ClassLoader loader)
          Checks if a set of interfaces has any clashes, meaning any methods with the same name and signature.
static boolean implementsInterface(ClassInfo classInfo, String interfaceName)
          Checks if a class implements a certain inteface, somewhere up in the class hierarchy, excluding itself.
static boolean instanceOf(ClassInfo classInfo, String superclassName)
          Checks if a class has a certain class as super class or interface, somewhere up in the class hierarchy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassInfoHelper

public ClassInfoHelper()
Method Detail

instanceOf

public static boolean instanceOf(ClassInfo classInfo,
                                 String superclassName)
Checks if a class has a certain class as super class or interface, somewhere up in the class hierarchy.

Parameters:
classInfo - the meta-data for the class to parse
superclassName - the name of the super class or interface
Returns:
true if we have a parse else false

implementsInterface

public static boolean implementsInterface(ClassInfo classInfo,
                                          String interfaceName)
Checks if a class implements a certain inteface, somewhere up in the class hierarchy, excluding itself.

Parameters:
classInfo -
interfaceName -
Returns:
true if we have a parse else false

extendsSuperClass

public static boolean extendsSuperClass(ClassInfo classInfo,
                                        String className)
Checks if a class has a certain class as super class, somewhere up in the class hierarchy.

Parameters:
classInfo - the meta-data for the class to parse
className - the name of the super class
Returns:
true if we have a parse else false

createMethodList

public static List createMethodList(ClassInfo klass)
Creates a method list of all the methods in the class and super classes, including package private ones. Inherited methods are last in the list.

Parameters:
klass - the class with the methods
Returns:
the sorted method list

collectMethodsFromInterface

public static List collectMethodsFromInterface(ClassInfo interfaceClassInfo)
Collects the methods from all the interface and its super interfaces.

Parameters:
interfaceClassInfo -
Returns:
list of methods declared in given class interfaces

collectMethodsFromInterfacesImplementedBy

public static List collectMethodsFromInterfacesImplementedBy(ClassInfo classInfo)
Collects the methods from all the interfaces of the class and its super interfaces.

Parameters:
classInfo -
Returns:
list of methods declared in given class interfaces

createInterfaceDefinedMethodList

public static List createInterfaceDefinedMethodList(ClassInfo klass,
                                                    List interfaceDeclaredMethods)
Creates a method list of all the methods in the class and super classes, if and only if those are part of the given list of interfaces declared methods.

Parameters:
klass - the class with the methods
interfaceDeclaredMethods - the list of interface declared methods
Returns:
the sorted method list

collectInterfaces

public static List collectInterfaces(ClassInfo classInfo)
Collects all the interface from the given class including the one from its super class.

Parameters:
classInfo -
Returns:
list of interface classInfo declared in given class and its hierarchy in correct order

hasMethodClash

public static boolean hasMethodClash(Set interfacesToAdd,
                                     ClassLoader loader)
Checks if a set of interfaces has any clashes, meaning any methods with the same name and signature.

Parameters:
interfacesToAdd -
loader -
Returns:
boolean


Copyright © 2002-2005 Jonas Bonér, Alexandre Vasseur. All Rights Reserved.