"java import" in script

Standard function in jython. With some quirks:

  • Wildcard imports are not supported for java packages.

  • Jython automatically "wraps" java objects with a dynamic subclass of PyObject, creating matching methods and fields. When such a wrapped object is handed to a true java method that doesn't take a PyObject, but does take the inner java type, the wrapper is automatically stripped back off.

  • Python native types are marshalled into similar java types. SImilar in reverse for java primitive types. Jython has a central system for managing and customizing this marshalling and unmarshalling process. See this related topic:

  • java's getXyz() and setXyz(val) are automatically mapped to jython property xyz via jython's internal java machinery that implements @property. So both the original java methods and a python-style property become available on such "NetBeans" objects. Using the property is fewer opcodes for the jython interpreter, so should be used wherever applicable.