Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Getting argument *types* from a JoinPoint

Try this in your advice (assuming it's advising methods, advices, constructors or initializes...):
	((CodeSignature) thisJoinPoint.getSignature()).getParameterTypes()
To get their names:
	((CodeSignature) thisJoinPoint.getSignature()).getParameterNames()

http://www.eclipse.org/aspectj/doc/released/runtime-api/org/aspectj/ lang/reflect/CodeSignature.html

HTH.

dean

On Oct 4, 2007, at 1:30 PM, Anthony N. Frasso wrote:

Hello, and thanks for your help in advance.

I'm using AspectJ to add a tracing module to my software. Because I suppose I'm a bit persnickety, the default method signature, nor the short or long
forms, suit what I'm trying to do.

I'd like to print trace messages in the following form:

    <class-name>.<method-name>(<arg1-type>, <arg2-type>, ...)

Is there any way to get the argument types as they are defined in the method signature from the JoinPoint? The only thing I've been able to do so far is get the arguments themselves, and get the arguments' classes, but that will get me the actual implementing class, not necessarily the type as defined in the method signature. Also, this doesn't work to well if one of the arguments is
null.

Any thoughts on how to accomplish this?

Thanks again for your help,
Anthony Frasso


______________________________________________________________________ ______________ Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get listings, and more!
http://tv.yahoo.com/collections/3658
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Dean Wampler, Ph.D.
dean at objectmentor.com
http://www.objectmentor.com
See also:
http://www.aspectprogramming.com  AOP advocacy site
http://aquarium.rubyforge.org     AOP for Ruby
http://www.contract4j.org         Design by Contract for Java5

I want my tombstone to say:
  Unknown Application Error in Dean Wampler.exe.
  Application Terminated.
      [Okay]        [Cancel]





Back to the top