[jboss-user] [JBoss Seam] - Protected methods on Seam components

quilleashm do-not-reply at jboss.com
Wed Feb 14 15:35:41 EST 2007


Hi all,

If I have a protected method in some circumstances on a Seam component I get an error when the method is called via a cglib proxy.
I get this exception thrown out of the cglib MethodProxy class.


  |                     throw new IllegalArgumentException("Protected method: " + sig1);
  | 

The class structure involved..


  | @Scope( ScopeType.STATELESS )
  | public abstract class ScreenActionComponent
  | {
  |     public abstract void execute( ScreenActionMetadata screenActionMetadata, ScreenActionContext screenActionContext );
  | 
  |     public abstract ScreenActionMetadata[] getScreenActionMetadata( ScreenActionContext screenActionContext );
  | }
  | 


  | public abstract class SingleItemScreenAction extends ScreenActionComponent
  | {
  |     public final void execute( ScreenActionMetadata screenActionMetadata, ScreenActionContext screenActionContext )
  |     {
  |         execute( screenActionContext );
  |     }
  | 
  |     public final ScreenActionMetadata[] getScreenActionMetadata( ScreenActionContext screenActionContext )
  |     {
  |         if ( isValidSelection( screenActionContext ) )
  |             return new ScreenActionMetadata[]{ new DefaultScreenActionMetadata( getDisplay(), getTooltip(), getImage() ) };
  |         else
  |             return new ScreenActionMetadata[ 0 ];
  |     }
  | 
  |     protected abstract void execute( ScreenActionContext screenActionContext );
  |     protected abstract boolean isValidSelection( ScreenActionContext screenActionContext );
  |     protected abstract String getDisplay();
  |     protected abstract String getTooltip();
  |     protected abstract String getImage();
  | }
  | 


  | @Name( "deleteEntityScreenAction" )
  | public class DeleteEntityScreenAction extends SingleItemScreenAction
  | {
  |     @In
  |     private Session referenceSession;
  | 
  |     public void execute( ScreenActionContext screenActionContext )
  |     {
  |         // TODO
  |     }
  | 
  |     public boolean isValidSelection( ScreenActionContext screenActionContext )
  |     {
  |         return !screenActionContext.getSelection().isEmpty();
  |     }
  | 
  |     protected final String getDisplay()
  |     {
  |         return "Delete";
  |     }
  | 
  |     protected final String getTooltip()
  |     {
  |         return "Logically deletes the selected items";
  |     }
  | 
  |     protected final String getImage()
  |     {
  |         // TODO:
  |         return null;
  |     }
  | }
  | 

Without the final modifiers on the DeleteEntityScreenAction getXXX methods I get the above exception when they are called from SingleItemScreenAction.getScreenActionMetadata().  But obviously with the final modifier I get no interception/bijection etc.

Wondered if this is a known limitation in cglib or not.

Cheers.

Mike.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4016602#4016602

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4016602



More information about the jboss-user mailing list