File: api.rst

package info (click to toggle)
python-jpype 1.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,984 kB
  • sloc: python: 18,767; cpp: 17,931; java: 8,448; xml: 1,305; makefile: 154; sh: 35
file content (126 lines) | stat: -rw-r--r-- 3,143 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
API Reference
=============

JVM Functions
~~~~~~~~~~~~~

These functions control and start the JVM.

.. autofunction:: jpype.startJVM
.. autofunction:: jpype.shutdownJVM
.. autofunction:: jpype.getDefaultJVMPath
.. autofunction:: jpype.getClassPath
.. autodecorator:: jpype.onJVMStart

Class importing
~~~~~~~~~~~~~~~

JPype supports several styles of importing.  The newer integrated style is 
provided by the imports_ module. The older ``JPackage`` method is available for 
accessing package trees with less error checking.  Direct loading of Java 
classes can be made with JClass_.

For convenience, the JPype module predefines the following ``JPackage`` 
instances for ``java`` and ``javax``.

.. autoclass:: jpype.JPackage

Class Factories
~~~~~~~~~~~~~~~

.. _JClass:

.. autoclass:: jpype.JClass
.. autoclass:: jpype.JArray
.. autoclass:: jpype.JException

Java Types
~~~~~~~~~~

JPype has types for each of the Java primitives: ``JBoolean``, ``JByte``,
``JShort``, ``JInt``, ``JLong``, ``JFloat`` and ``JDouble``.  There is one
class for working with Java objects, ``JObject``.  This serves to cast to a
specific object type.  

.. autoclass:: jpype.JObject

.. _threading:

Threading
~~~~~~~~~

.. autofunction:: jpype.synchronized
.. autoclass:: java.lang.Thread
    :members:


Decorators
~~~~~~~~~~~

JPype uses ordinary Python classes to implement functionality in Java. Adding 
these decorators to a Python class will mark them for use by JPype to interact 
with Java classes.

.. autodecorator:: jpype.JConversion
.. autodecorator:: jpype.JImplementationFor
.. autodecorator:: jpype.JImplements
.. autodecorator:: jpype.JOverride


Proxies
~~~~~~~

JPype can implement Java interfaces either by using decorators or by manually 
creating a JProxy.  Java only support proxying interfaces, thus we cannot 
extend an existing Java class.

.. autoclass:: jpype.JProxy


Customized Classes
~~~~~~~~~~~~~~~~~~

JPype provides standard customizers for Java interfaces so that Java objects 
have syntax matching the corresponding Python objects. The customizers are 
automatically bound to the class on creation without user intervention.  We are 
documentating the functions that each customizer adds here.  Information about
Java methods can be found in the Javadoc.

These internal classes can be used as example of how to implement your own 
customizers for Java classes.

.. autoclass:: java.util.Iterable
    :members:
    :special-members:
.. autoclass:: java.util.Collection
    :members:
    :special-members:
.. autoclass:: java.util.List
    :members:
    :special-members:
.. autoclass:: java.util.Map
    :members:
    :special-members:
.. autoclass:: java.util.Set
.. autoclass:: java.util.Iterator
.. autoclass:: java.util.Enumeration
.. autoclass:: java.lang.AutoCloseable

Modules
~~~~~~~

Optional JPype behavior is stored in modules. These optional modules can be 
imported to add additional functionality.

.. _imports:

.. automodule:: jpype.imports

.. automodule:: jpype.pickle
.. autoclass:: jpype.pickle.JPickler
.. autoclass:: jpype.pickle.JUnpickler

.. automodule:: jpype.beans

.. automodule:: jpype.types