Skip to content
This repository has been archived by the owner on Aug 5, 2021. It is now read-only.

Latest commit

 

History

History
422 lines (297 loc) · 22.4 KB

reference.rst

File metadata and controls

422 lines (297 loc) · 22.4 KB

Reference

Python API

This reference addresses the jpy Python module.

jpy Functions

Variables

Types

You will never have to use the following type directly. But it may be of use to know where they come from when they are referred to, e.g. in error messages.

Type Conversions

This section describes the type possible type conversions made by jpy when Python values are passed as arguments to Java typed parameters. In the tables given below are the generated match values ranging from (types never match) to 100 (full match) when comparing a given Java parameter type (rows) with a provided Python value (columns). These match values are also used for finding the best matching Java method overload for a given Python argument tuple.

Java primitive types

NoneType bool int float number
boolean

1

100

10

0

0

char

0

10

100

0

0

byte

0

10

100

0

0

short

0

10

100

0

0

int

0

10

100

0

0

long

0

10

100

0

0

float

0

1

10

90

50

double

0

1

10

100

50

Java object types

NoneType bool int float str
java.lang.Boolean

1

100

10

0

0

java.lang.Character

1

10

100

0

0

java.lang.Byte

1

10

100

0

0

java.lang.Short

1

10

100

0

0

java.lang.Integer

1

10

100

0

0

java.lang.Long

1

10

100

0

0

java.lang.Float

1

1

10

90

0

java.lang.Double

1

1

10

100

0

java.lang.String

1

0

0

0

100

java.lang.Object

1

10

10

10

10

Java primitive array types

NoneType seq buf('b') buf('B') buf('u') buf('h') buf('H') buf('i') buf('I') buf('l') buf('L') buf('q') buf('Q') buf('f') buf('d')
boolean[]

1

10

100

100

0

0

0

0

0

0

0

0

0

0

0

char[]

1

10

0

0

100

80

90

0

0

0

0

0

0

0

0

byte[]

1

10

100

90

0

0

0

0

0

0

0

0

0

0

0

short[]

1

10

0

0

0

100

90

0

0

0

0

0

0

0

0

int[]

1

10

0

0

0

0

0

100

90

100

90

0

0

0

0

long[]

1

10

0

0

0

0

0

0

0

0

0

100

90

0

0

float[]

1

10

0

0

0

0

0

0

0

0

0

0

0

100

0

double[]

1

10

0

0

0

0

0

0

0

0

0

0

0

0

100

If a python buffer is passed as argument to a primitive array parameter, but it doesn't match the buffer types given above, the a match value of 10 applies, as long as the item size of a buffer matches the Java array item size.

Java object array types

todo

Java API

jpy's Java API documentation has been generated from Java source code using the javadoc tool. It can be found here.