Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] isotaling calls to methods on nested classes

Hi Hugh,

How about :
declare error: 
((call(* curam.rules.rdo.ISAssessmentConstantGroup.getk*() )
	|| (call(* curam..*.setValue(..))))
&& !within(curam.rules.loaders.ISAssessmentConstantLoader) ) :
"Illegal to set Evidence outside Specified Loader";

The first call is to getk* instead of get*, and the second call is to
setValue() for all classes with all parameters.  Depending on your
application and naming conventions used this could be what you want.

HTH,

Fintan

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] 
Sent: 08 April 2005 16:58
To: 'aspectj-users@xxxxxxxxxxx'
Subject: RE: [aspectj-users] isotaling calls to methods on nested
classes



  Fintan

             The getters can return arbitrary objects sometimes Integer,
Boolean or some other defined class that has a setValue method on it 

Hugh McBride


-----Original Message-----
From: Conway. Fintan (IT Solutions) [mailto:Fintan.Conway@xxxxxx] 
Sent: 08 April 2005 16:47
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] isotaling calls to methods on nested
classes

Hi Hugh,

Do your kIsAge* classes extend a common superclass, or interface?

If so you could try something like the following :


	call(* curam..commonSuperclass+.setValue(..))
	&& within(ISCAAssessmentHouseholdLoader)

To get these setValue calls

HTH,

Fintan

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] 
Sent: 08 April 2005 15:52
To: 'aspectj-users@xxxxxxxxxxx'
Subject: [aspectj-users] isotaling calls to methods on nested classes 


I am trying to run a compile time policing tool on generated code to
make sure that certain classes are only called from within specified
loader class

This captures all the get values which is correct but I need to capture
The set values on the classes returned by these calls.  

I am pretty new to aspects 2-3 weeks and would appreciate any
help/pointers

Hugh McBride
/////////////////////////// aspect ///////////////////////////////////
Aspect FindLoaderError
{
	declare error: (call(*
curam.rules.rdo.ISAssessmentConstantGroup.get*() )	&& !within(
curam.rules.loaders.ISAssessmentConstantLoader) ) :"Illegal to set
Evidence outside Specified Loader";  }


//////////////////sample class
//////////////////////////////////////////////


package doofus.rules.loaders;


public class ISCAAssessmentHouseholdLoader extends
doofus.util.rules.Loader {
    // Constructor
    public ISCAAssessmentHouseholdLoader(String s)
    {
        super(s);
    }


    //////////////////// Error Generating code  //
/////////////////////////////////

    protected final static int kAge65 = 65;
    protected final static int kAge1 = 1;
    protected final static int kAge5 = 5;
    /////////////////////////////---------  //
////////////////////////////////////

    protected void load(RulesParameters rp) throws Exception
    {

       
        //TODO Error manually introduced for testing : Hugh McBride
        ISAssessmentConstantGroup rdoISAssessmentConstant =
ISAssessmentConstantGroup.getCurrentInstance(rp);

        rdoISAssessmentConstant.getkISAge65().setValue(kAge65);
        rdoISAssessmentConstant.getkISAge1().setValue(kAge1);
        rdoISAssessmentConstant.getkISAge5().setValue(kAge5);

     //  declare error: (call(*
doofus.rules.rdo.ISAssessmentConstantGroup.get*() ) && !within(
doofus.rules.loaders.ISAssessmentConstantLoader) ) :"Illegal to set
Evidence outside Specified Loader";
     //  This call will capture this point cut but it also captures
others like
     //  rdoISAssessmentConstant.getkISAge5().getValue(rp);
     //  which is a sample of code existing in the program
     //  I need to capture all the setValueMethods i.e
    //   rdoISAssessmentConstant.getkISAge65().setValue(kAge65);
	//   rdoISAssessmentConstant.getkISAge1().setValue(kAge1);
    //   rdoISAssessmentConstant.getkISAge5().setValue(kAge5);


    }
} 
The information in this email is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this
email by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution or any action taken or
omitted to be taken in reliance on it, is prohibited and may be
unlawful. If you are not the intended addressee please contact the
sender and dispose of this e-mail. Thank you.
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


* ** *** ** * ** *** ** * ** *** ** * 
This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they 
are addressed. 
Any views or opinions presented are solely those of the author, and do
not necessarily 
represent those of ESB. 
If you have received this email in error please notify the sender. 
 
Although ESB scans e-mail and attachments for viruses, it does not
guarantee

that either are virus-free and accepts no liability for any damage
sustained

as a result of viruses. 
 
* ** *** ** * ** *** ** * ** *** ** *

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
The information in this email is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this
email by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution or any action taken or
omitted to be taken in reliance on it, is prohibited and may be
unlawful. If you are not the intended addressee please contact the
sender and dispose of this e-mail. Thank you.
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top