Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] getArgs() and primitive types

Oleg,

I ran into a similar problem recently while working on <shamelss-plus>Contract4J</shameless-plus>. I believe that getClass() on your objects will return Integer.TYPE, rather than some other instance of the Integer class, and similarly for the other wrappers, if the object is actually a wrapper around a primitive type.

If you just need to report the "true" type of the object, I think that obj.getClass().toString() on one of these wrappers outputs "int", "float", etc., while an object that isn't primitive will result in "java.lang.Integer", etc.

Let me know if this works!

dean

Oleg Lebedev wrote:
Greetings.
How can I tell whether an argument in an Object array returned from JointPoint.getArgs() has a primitive type? What I am trying to do is to record a method execution and all the parameters passed to the method. I also need to be able to distinguish between Integer and int parameters. However, ints are wrapped in Integers when returned by getArgs() method. Is there a way to tell that even though getArgs() returned an Integer object, in reality the method takes an int as a parameter? Thanks. *Oleg Lebedev*
Software Architect
Waterford Research Institute
Phone: 801.938.1724
Cell: 801.209.6706

------------------------------------------------------------------------

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

--
Dean Wampler, Ph.D.
dean at aspectprogramming.com
http://www.aspectprogramming.com
http://www.contract4j.org
I want my tombstone to say:
   Unknown Application Error in Dean Wampler.exe.
   Application Terminated.
   [Okay]    [Cancel]


Back to the top