pl.edu.agh.cast.util.reflect
Class PolymorphicMethod

java.lang.Object
  extended by pl.edu.agh.cast.util.reflect.PolymorphicMethod

public final class PolymorphicMethod
extends Object

A wrapper for Method class. It is intended to supply means of comparing methods which may be polymorphic.

Author:
AGH CAST Team

Constructor Summary
PolymorphicMethod(Method method)
          Creates new Method wrapper.
 
Method Summary
static boolean areMethodsEqual(Method m1, Method m2)
          Checks if given two Methods have the same signature (name and list of parameters).
 boolean equals(Object obj)
          This method is to verify if this method may be a polymorphic (specialized) version of given Method or PolymorphicMethod.
 Method getMethod()
           
 int hashCode()
          
static boolean isOverridingMethod(Method original, Method overriding)
          Checks if a method could be a polymorphic version of another method.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PolymorphicMethod

public PolymorphicMethod(Method method)
Creates new Method wrapper.

Parameters:
method - method to wrap
Method Detail

getMethod

public Method getMethod()

areMethodsEqual

public static boolean areMethodsEqual(Method m1,
                                      Method m2)
Checks if given two Methods have the same signature (name and list of parameters).

Parameters:
m1 - the first method
m2 - the second method
Returns:
true if m1 and m2 are both null or have the same signature

isOverridingMethod

public static boolean isOverridingMethod(Method original,
                                         Method overriding)
Checks if a method could be a polymorphic version of another method. That means that the methods have the same signature and the overriding candidate has a covariant return type.

Parameters:
original - the method that may be overridden
overriding - the method that may be overriding the original method
Returns:
true if the overriding method may override the original one

equals

public boolean equals(Object obj)
This method is to verify if this method may be a polymorphic (specialized) version of given Method or PolymorphicMethod.

Overrides:
equals in class Object
Parameters:
obj - object to compare
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

toString

public String toString()

Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.