Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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.


Back to the top