Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ajdt-dev] Declaring methods in interface through Aspect


Hi All,
I checked the compiled classes(open it with cavaj) found the interface is created with out any implementation.The sytem.out line was also not there but it stayed in aspect(compiled file) as a static method with the System.out. Implementation.So is that means I cant declare in a interface ?Or do i make it to be abstract.
Thanks,
Vinodh Subbiah
Retail Shared Infrastructure Team
JPM
614 213 1574 (W)
602 403 8451(M)
vinodhts@xxxxxxxxx






vinodh.t.subbiah@xxxxxxxxxxxx
Sent by: ajdt-dev-bounces@xxxxxxxxxxx

04/13/2006 11:22 AM
Please respond to AspectJ Development Tools developer discussions

       
        To:        ajdt-dev@xxxxxxxxxxx
        cc:        
        Subject:        [ajdt-dev] Declaring methods in interface through Aspect




Hi All,

Im trying to add a method declaration in an Interface IAccountSDB.

But when i try to add it in Aspect it gives me compilation error saying no body implemented.Then I try to implement the body in the Class SDBRental which extends the IAccountSDB.

Still I was getting the error and finally i add the dummy implementation { ...} and it got compiled and also running correctly.But why i need to provide this implementation when I want to really declare the method in interface only?

Code shown as below.


Also it is not giving any compilation error if the sub class does not implement the methods in interface !.When i run i saw the method declared in interface gets called !Please help to resolve this issue.(It behaves like abstract class implementation)


package my.rsi.aspect.management;

import com.chase.rsi.model.repository.SafeDepositBoxRentalResponse;

import com.chase.rsi.model.service.*;

import  my.rsi.management.*;

import com.chase.rsi.model.repository.*;

import com.chase.rsi.model.service.exception.ServiceException;


/**

 */

public aspect SDBAccountService {

       declare parents : SDBRental implements IAccountSDB;

       public SafeDepositBoxRentalResponse IAccountSDB.rental2SafeDepositBox(

               RequestContext context, AccountIdentifier accountIdentifier,SafeDepositInfo safeDepositInfo)

               throws ServiceException{

               System.out.println(" Why I have to give implementation in interface itself? ");

               return null;

       }

       
       
       
       public SafeDepositBoxRentalResponse SDBRental.rental2SafeDepositBox(

               RequestContext context, AccountIdentifier accountIdentifier,SafeDepositInfo safeDepositInfo)

               throws ServiceException{

               System.out.println(" IN SDBRental.rental2SafeDepositBox Interface");

               return null;

       }

       public SafeDepositBoxRentalResponse SDBRental.rentalSafeDepositBox(

               RequestContext context, AccountIdentifier accountIdentifier,SafeDepositInfo safeDepositInfo)

               throws ServiceException{

               System.out.println(" IN SDBRental.rentalSafeDepositBox Interface");

               return null;

       }

       public static void main(String [] args)

       {

               SDBRental sdbRental = new SDBRental();

               try {

               sdbRental.rentalSafeDepositBox(null,null,null);

               sdbRental.rental2SafeDepositBox(null,null,null);

               }catch(Exception e)

               {

                       System.out.println("Exception in main");

               }

       }

       
}
Vinodh Subbiah
Retail Shared Infrastructure Team
JPM
614 213 1574 (W)
602 403 8451(M)
vinodhts@xxxxxxxxx



_______________________________________________
ajdt-dev mailing list
ajdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ajdt-dev


Back to the top