Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » how can i block calls from package to another?(trying to enforce standards)
icon5.gif  how can i block calls from package to another? [message #552496] Thu, 12 August 2010 11:42 Go to next message
elhanan Maayan is currently offline elhanan MaayanFriend
Messages: 131
Registered: November 2009
Senior Member
hi..

i would like to create a pointcut that will detected any calls that classes from package com.pnx.**.command.** to classes com.pnx.**.bo.** package, and give a compiler error. is there a way to do that?
Re: how can i block calls from package to another? [message #552616 is a reply to message #552496] Thu, 12 August 2010 20:59 Go to previous messageGo to next message
Andrew Eisenberg is currently offline Andrew EisenbergFriend
Messages: 382
Registered: July 2009
Senior Member
Yes, you want to use a declare error statement. This will give you compile time feedback and produce a compile error.

I think something like should work:

aspect A {
declare error : call(* com.pnx.**.command.**.*(..)) : "Invalid method call";
}

Or something like that.
Re: how can i block calls from package to another? [message #552745 is a reply to message #552616] Fri, 13 August 2010 11:17 Go to previous message
elhanan Maayan is currently offline elhanan MaayanFriend
Messages: 131
Registered: November 2009
Senior Member
got it, like this:
[CODE][public aspect NoBoInsideCommands {
declare error : call(* com.pnx.**.command.**.*.*(..) ) && within(com.pnx.**.bo.**.*) : "cannot call command inside bo";
}/CODE]
Previous Topic:"Deployable plug-ins and fragments with AspectJ support" missing in 3.6
Next Topic:how can i block calls from package to another?
Goto Forum:
  


Current Time: Thu Apr 25 22:50:05 GMT 2024

Powered by FUDForum. Page generated in 0.02937 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top