[JBoss-dev] calling a super method implementation

Emmanuel Bernard emmanuel.bernard at jboss.com
Wed Jul 26 17:51:33 EDT 2006


The reasoning behind that is the EJB3 spec

A class is permitted to override an inherited callback method of the 
same callback type, and in this case, the overridden
method is not invoked. Note that if *a method overrides an inherited 
callback method* but specifies a different lifecycle event or *is not a 
lifecycle callback
method* (ie not annotated), *the overridden method will be invoked*.

Emmanuel Bernard wrote:
>
>
> I don't know how to (or if it's even possible to) call by reflection a 
> super implementation of a given method
>
> public class SuperA {
> public void testDisplay() {
>    System.out.println("SuperA");
> }
> }
>
> public class A extends SuperA {
> public void testDisplay() {
>    System.out.println("A");
> }
> }
>
> SuperA.class.getDeclaredMethod("testDisplay", new Class[] 
> {}).invoke(aInstance, new Object[] {});
> will actually display 'A'
>
> I'd like to display 'SuperA'
>
> Any help apreciated
>
>
> _______________________________________________
> jboss-development mailing list
> jboss-development at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-development
>



More information about the jboss-development mailing list