Clamp employs six (possibly seven) metaprogramming functionalities in Python/Jython:
-
Metaclass support, which required unifying Java types (rooted by
java.lang.Class
) and Python new-style classes (rooted bytype
). This then enable the metaclass to build the desired class shape. It can do the following: constant type inference; construction of getters/setters; etc. -
Brand new,
__proxymaker__
allows for aCustomMaker
to intercept the construction of a Java proxy. (Jython specific.) -
Import hooks, to intercept the import of Java annotations. In particular, this means class annotations can be augmented (monkeypatched?) so they can be used as class decorators; method annotations so they can be used function decorators. Field annotations can be directly used by the metaclass support when working with a field.
-
Class decorators.
-
ASM bytecode rewriting. Requires interception at jar build.
-
pth support
And since this is really more of a hook in setuptools:
- More of a hook of setuptools - custom setuptools hooks.