Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] (no subject)

How about something like (untested syntax):

String around() : call(* *.getAString()) {
      String origString = proceed();
      // do the test for variables
      if (origString.indexOf("$") >= 0) {
            String changedString = ... // eval vars
            return changedString;
      }
      return origString;
}

Not sure if the getAString was a specific method or an example signature.

Ken



                                                                                                                                                                          
                      Jason van Zyl                                                                                                                                       
                      <jason@xxxxxxxxxxx>         To:       aspectj-users@xxxxxxxxxxx                                                                                     
                      Sent by:                    cc:                                                                                                                     
                      aspectj-users-admin@        Subject:  [aspectj-users] (no subject)                                                                                  
                      eclipse.org                                                                                                                                         
                                                                                                                                                                          
                                                                                                                                                                          
                      17/06/2003 01:13                                                                                                                                    
                      Please respond to                                                                                                                                   
                      aspectj-users                                                                                                                                       
                                                                                                                                                                          
                                                                                                                                                                          




Hi,

Say I have the following:

Project p = createProject( f );
String s =  p.getN0().getN1().getN2()...getNM().getAString()
           ^
           ^
                I

What is the best way to intercept the String returned by this call chain
to perform some transformation?

Specifically p is an object that is created by unmarshalling an XML
document which may contain ${foo} references. I would like to check I
for any of these references and interpolate the real value of foo into
the String before returning it to the caller.

--
jvz.

Jason van Zyl
jason@xxxxxxxxxxx
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.

  -- Jacques Ellul, The Technological Society

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users





--

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.




Back to the top