| Re: [aspectj-users] selecting join points using annotations |
|
Ok...I almost have it working.
Here is my aspect:
public aspect Encryption { pointcut encrypt(String data): args(data) && execution(public void com.company..model.*.set*(String)); pointcut decrypt(): execution(public String com.company.model.*.get*()); void around(String data) : encrypt(data) {String encryptedData = encryptData(data); proceed(encryptedData);} String around(): decrypt() {String encryptedData = proceed();String decryptedData = decryptData(encryptedData); return decryptedData;} private String encryptData(String data) { // dummy implementation return data;} private String decryptData(String data) { // dummy implementation return data;} } This works...as in it picks out all model getter/setter methods.
However, when I add the annotation selection criteria: pointcut encrypt(String data): args (data) && execution(@Encrypt public void com.company..model.*.set*(String)); pointcut decrypt(): execution(@Decrypt public String com.company.model.*.get*());AJDT reports this as a warning and the selections no longer match. I get "no match for this type name: Encrypt[Xlint:invalidAbsoluteTypeName]" The @Encrypt annotation is defined and I have one method on a single model annotated.
Any ideas on why the join point selection with the annotation doesn't seem to work?
/robert
|