ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> Jython-users
Jython-users
Re: [Jython-users] Auto getter/setter generation?
by Diez B. Roggisch other posts by this author
Dec 4 2004 5:35PM messages near this date
[Jython-users] Auto getter/setter generation? | [Jython-users] GUI for Jython app
Am Samstag, 4. Dezember 2004 07:10 schrieb Owen Densmore:
>  I'm using Jython within a Java framework which uses bean
>  getter/setters.  Thus when I build a class in Jython to be used by this
>  framework, I need to build getter/setter methods in the Jython class.
> 
>  My question is: is there a way to have Jython auto-generate these?
>  Groovy, for example, intercepts getter/setters from Java and
>  automatically converts them to property/attribute requests.  I presume
>  because Jython has foo.var abbreviations, it might somehow do a similar
>  thing, removing the need for the annoying getter/setter hand-made code.

Certainly not - in jython you can do:

class Foo():
   def __init__(self):
        if relative_moon_moisture >  0.3:
               self.__dict__[generate_property_name()] = "jikes"


This is totally runtime dependand, and can't be foreseen. So there is no way 
the compiler could introduce compile-time methods for that.

Maybe the compiler could add some magic if a __slots__ property is used - but 
as these are new-style class features, its only to happen in upcoming 
versions. 

Diez


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Jython-users mailing list
Jython-users@[...].net
https://lists.sourceforge.net/lists/listinfo/jython-users
Thread:
Owen Densmore
Diez B. Roggisch

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved