determining whether a method is a getter/setter

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

determining whether a method is a getter/setter

Rob Vens-2
I am looking for a simple way to determine whether a method in a class (i.e. an instance of CompiledMethod) is a getter or a setter. Anybody done something I could reuse?
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: determining whether a method is a getter/setter

Karsten Kusche
Hi Rob,

If you inspect the methods, a getter seems to always have bytes like 0x01 0x65 (pust instVar 1; return). So if that's the case, you might have a getter. Same goes for setters: 0x10 0x59 0x60 (push arg, assign to instVar 1, return self).

Karsten



-- 
Karsten Kusche - Dipl. Inf. - [hidden email]
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812 

Am Montag, 19. Dezember 2011 um 10:45 schrieb Rob Vens:

I am looking for a simple way to determine whether a method in a class (i.e. an instance of CompiledMethod) is a getter or a setter. Anybody done something I could reuse?
_______________________________________________
vwnc mailing list


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc