Vinodh,
You need to use the abstract modifier to
make it work. ITD’s on an interface aren’t abstract by default, as
you discovered, but if you do make them abstract you can implement them in the class
instead. E.g.,
interface Sample {}
public aspect AbstractInterfaceMethod {
public abstract void
Sample.ImplementMe();
}
From:
ajdt-dev-bounces@xxxxxxxxxxx [mailto:ajdt-dev-bounces@xxxxxxxxxxx] On Behalf Of vinodh.t.subbiah@xxxxxxxxxxxx
Sent: Thursday, April 13, 2006
11:23 AM
To: ajdt-dev@xxxxxxxxxxx
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
|
|
|