Re: Annotation support
Jim Baker <[email protected]>
| Newsgroups | gmane.comp.lang.jython.devel |
|---|---|
| Message-ID | <CAOhO=aPneSyWWxzMzYQrYmdabiBdd=vw2VKOo2rBeL6QCwwW+w@mail.gmail.com> |
Caleb, This is a great question! So there are two annotation/decorator scenarios to consider: *Clamp-specific Python decorators. *This is what you mentioned in http://clamp.readthedocs.org/en/latest/clamp.html; they are not yet supported in Clamp! Darjus Loktevic (cc-ed) has been playing with this approach, so I will let him speak to any specifics in terms of what progress he has made. However, the basic idea is that we can generate the Java method type signatures based on these decorators, without requiring that the Python class implements Java interface(s) and/or extends a Java class. In terms of implementation, presumably this should start with ClampProxyMakerMeta as defined in clamp.declarative. This metaclass, which has a construction inspired by SQLAlchemy, could be further refined such that it can access any metadata that the Clamp-specific decorators record for a class to be constructed (code that would need to be written!), then generating appropriate type signatures via org.python.compiler.ProxyMaker#addMethod *Java annotations as Python decorators*. This is the idea that I describe in some detail https://github.com/jythontools/clamp#supporting-java-annotations for ensuring that Python classes/methods have appropriate Java annotation metadata. Pull requests are certainly welcome. But perhaps even more important, we really need to first add unit tests to Clamp, beyond some simple functional testing provided by the Clamped companion project. (The current implementation of Clamp started out as a very useful spike... sorry about that!) - Jim On Tue, Sep 23, 2014 at 7:03 AM, Caleb P. Burns <[email protected]> wrote: > Jython developers, > > How relevant are the docs for v0.1 of Clamp over at < > http://clamp.readthedocs.org/en/latest/clamp.html>? It describes > decorators such as `clamp.method` and `clamp.annotated`. The current > version of Clamp (0.4) has no mention to these decorators. > > I am working on adding basic support for Java annotations into Clamp. At > the moment I have annotations for classes working with a decorator > (`clamp.annotated`). However, I am stuck on how to approach implementing > them for Python methods. Arbitrary python methods don't get exported. And > before one can export a python method, it needs to have a useful Java > return type and parameter types. Is it desired to have a decorator such as > `clamp.method` to specify its signature? > > Any help or advice would be greatly appreciated. > > Caleb Burns > > > ------------------------------------------------------------------------------ > Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer > Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports > Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper > Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer > > http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk > _______________________________________________ > Jython-dev mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/jython-dev > > -- - Jim jim.baker@{colorado.edu|python.org|rackspace.com|zyasoft.com} twitter.com/jimbaker github.com/jimbaker bitbucket.com/jimbaker ------------------------------------------------------------------------------ Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk _______________________________________________ Jython-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jython-dev