Top Description Inners Fields Constructors Methods
org.python.core

pack-priv abstract Class Operations

extends Object
Class Inheritance
Known Direct Subclasses
org.python.core.Operations.Accepted, org.python.core.Operations.Derived, org.python.core.PyType
Static Imports
java.lang.invoke.MethodHandles.exactInvoker, .MethodHandles.filterReturnValue, .MethodHandles.foldArguments, org.python.core.ClassShorthand.O, .ClassShorthand.T

An Operations object provides behaviour to a Java object by defining, for its Java class, a MethodHandle on the implementation of each special method required by the implementation and enumerated in Slot. (This is almost the same as the set of special methods defined by the Python data model.)

The run-time system will form a mapping from each Java class to an instance of (a specific sub-class of) Operations. Apart from a small collection of bootstrap classes (all of them built-in types), this mapping will be developed as the classes are encountered through the use of instances of them in Python code.

In cases where the behaviour depends on the Python type as well as the Java class, this is taken care of within the handle embedded in the Operations object for the Java class.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
Operations.Accepted

Operations for an accepted implementation (non-canonical implementation) are represented by an instance of this class.

pack-priv static class
Operations.BinopGrid

A table of binary operations that may be indexed by a pair of classes (or their Operations objects).

pack-priv static class
Operations.Clash

Exception reporting that an attempt was made to register a second Operations object against a class already in the registry.

pack-priv static class
Operations.Derived

Operations for a Python class defined in Python are represented by an instance of this class.

private static class
Operations.Registry

There is only one instance of this class and it is Operations#registry.

Field Summary

Modifier and TypeField and Description
pack-priv static final Operations
DERIVED

The Operations object of sub-classes of built-in types.

pack-priv MethodHandle
op_abs

Handle on special method __abs__, described by Slot#op_abs.

pack-priv MethodHandle
op_add

Handle on special method __add__, described by Slot#op_add.

pack-priv MethodHandle
op_aiter

Handle on special method __aiter__, described by Slot#op_aiter.

pack-priv MethodHandle
op_and

Handle on special method __and__, described by Slot#op_and.

pack-priv MethodHandle
op_anext

Handle on special method __anext__, described by Slot#op_anext.

pack-priv MethodHandle
op_await

Handle on special method __await__, described by Slot#op_await.

pack-priv MethodHandle
op_bool

Handle on special method __bool__, described by Slot#op_bool.

pack-priv MethodHandle
op_call

Handle on special method __call__, described by Slot#op_call.

pack-priv MethodHandle
op_contains

Handle on special method __contains__, described by Slot#op_contains.

pack-priv MethodHandle
op_delattr

Handle on special method __delattr__, described by Slot#op_delattr.

pack-priv MethodHandle
op_delete

Handle on special method __delete__, described by Slot#op_delete.

pack-priv MethodHandle
op_delitem

Handle on special method __delitem__, described by Slot#op_delitem.

pack-priv MethodHandle
op_divmod

Handle on special method __divmod__, described by Slot#op_divmod.

pack-priv MethodHandle
op_eq

Handle on special method __eq__, described by Slot#op_eq.

pack-priv MethodHandle
op_float

Handle on special method __float__, described by Slot#op_float.

pack-priv MethodHandle
op_floordiv

Handle on special method __floordiv__, described by Slot#op_floordiv.

pack-priv MethodHandle
op_ge

Handle on special method __ge__, described by Slot#op_ge.

pack-priv MethodHandle
op_get

Handle on special method __get__, described by Slot#op_get.

pack-priv MethodHandle
op_getattr

Handle on special method __getattr__, described by Slot#op_getattr.

pack-priv MethodHandle
op_getattribute

Handle on special method __getattribute__, described by Slot#op_getattribute.

pack-priv MethodHandle
op_getitem

Handle on special method __getitem__, described by Slot#op_getitem.

pack-priv MethodHandle
op_gt

Handle on special method __gt__, described by Slot#op_gt.

pack-priv MethodHandle
op_hash

Handle on special method __hash__, described by Slot#op_hash.

pack-priv MethodHandle
op_iadd

Handle on special method __iadd__, described by Slot#op_iadd.

pack-priv MethodHandle
op_iand

Handle on special method __iand__, described by Slot#op_iand.

pack-priv MethodHandle
op_ifloordiv

Handle on special method __ifloordiv__, described by Slot#op_ifloordiv.

pack-priv MethodHandle
op_imatmul

Handle on special method __imatmul__, described by Slot#op_imatmul.

pack-priv MethodHandle
op_imod

Handle on special method __imod__, described by Slot#op_imod.

pack-priv MethodHandle
op_imul

Handle on special method __imul__, described by Slot#op_imul.

pack-priv MethodHandle
op_index

Handle on special method __index__, described by Slot#op_index.

pack-priv MethodHandle
op_init

Handle on special method __init__, described by Slot#op_init.

pack-priv MethodHandle
op_int

Handle on special method __int__, described by Slot#op_int.

pack-priv MethodHandle
op_invert

Handle on special method __invert__, described by Slot#op_invert.

pack-priv MethodHandle
op_ior

Handle on special method __ior__, described by Slot#op_ior.

pack-priv MethodHandle
op_isub

Handle on special method __isub__, described by Slot#op_isub.

pack-priv MethodHandle
op_iter

Handle on special method __iter__, described by Slot#op_iter.

pack-priv MethodHandle
op_itruediv

Handle on special method __itruediv__, described by Slot#op_itruediv.

pack-priv MethodHandle
op_ixor

Handle on special method __ixor__, described by Slot#op_ixor.

pack-priv MethodHandle
op_le

Handle on special method __le__, described by Slot#op_le.

pack-priv MethodHandle
op_len

Handle on special method __len__, described by Slot#op_len.

pack-priv MethodHandle
op_lshift

Handle on special method __lshift__, described by Slot#op_lshift.

pack-priv MethodHandle
op_lt

Handle on special method __lt__, described by Slot#op_lt.

pack-priv MethodHandle
op_matmul

Handle on special method __matmul__, described by Slot#op_matmul.

pack-priv MethodHandle
op_mod

Handle on special method __mod__, described by Slot#op_mod.

pack-priv MethodHandle
op_mul

Handle on special method __mul__, described by Slot#op_mul.

pack-priv MethodHandle
op_ne

Handle on special method __ne__, described by Slot#op_ne.

pack-priv MethodHandle
op_neg

Handle on special method __neg__, described by Slot#op_neg.

pack-priv MethodHandle
op_next

Handle on special method __next__, described by Slot#op_next.

pack-priv MethodHandle
op_or

Handle on special method __or__, described by Slot#op_or.

pack-priv MethodHandle
op_pos

Handle on special method __pos__, described by Slot#op_pos.

pack-priv MethodHandle
op_pow

Handle on special method __pow__, described by Slot#op_pow.

pack-priv MethodHandle
op_radd

Handle on special method __radd__, described by Slot#op_radd.

pack-priv MethodHandle
op_rand

Handle on special method __rand__, described by Slot#op_rand.

pack-priv MethodHandle
op_rdivmod

Handle on special method __rdivmod__, described by Slot#op_rdivmod.

pack-priv MethodHandle
op_repr

Handle on special method __repr__, described by Slot#op_repr.

pack-priv MethodHandle
op_rfloordiv

Handle on special method __rfloordiv__, described by Slot#op_rfloordiv.

pack-priv MethodHandle
op_rlshift

Handle on special method __rlshift__, described by Slot#op_rlshift.

pack-priv MethodHandle
op_rmatmul

Handle on special method __rmatmul__, described by Slot#op_rmatmul.

pack-priv MethodHandle
op_rmod

Handle on special method __rmod__, described by Slot#op_rmod.

pack-priv MethodHandle
op_rmul

Handle on special method __rmul__, described by Slot#op_rmul.

pack-priv MethodHandle
op_ror

Handle on special method __ror__, described by Slot#op_ror.

pack-priv MethodHandle
op_rpow

Handle on special method __rpow__, described by Slot#op_rpow.

pack-priv MethodHandle
op_rrshift

Handle on special method __rrshift__, described by Slot#op_rrshift.

pack-priv MethodHandle
op_rshift

Handle on special method __rshift__, described by Slot#op_rshift.

pack-priv MethodHandle
op_rsub

Handle on special method __rsub__, described by Slot#op_rsub.

pack-priv MethodHandle
op_rtruediv

Handle on special method __rtruediv__, described by Slot#op_rtruediv.

pack-priv MethodHandle
op_rxor

Handle on special method __rxor__, described by Slot#op_rxor.

pack-priv MethodHandle
op_set

Handle on special method __set__, described by Slot#op_set.

pack-priv MethodHandle
op_setattr

Handle on special method __setattr__, described by Slot#op_setattr.

pack-priv MethodHandle
op_setitem

Handle on special method __setitem__, described by Slot#op_setitem.

pack-priv MethodHandle
op_str

Handle on special method __str__, described by Slot#op_str.

pack-priv MethodHandle
op_sub

Handle on special method __sub__, described by Slot#op_sub.

pack-priv MethodHandle
op_truediv

Handle on special method __truediv__, described by Slot#op_truediv.

pack-priv MethodHandle
op_xor

Handle on special method __xor__, described by Slot#op_xor.

pack-priv static final Operations.Registry
registry

Mapping from Java class to the Operations object that provides instances of the class with Python semantics.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static Operations

Returns:

Operations providing Python semantics
fromClass
(Class<?>
class on which operations are required
c
)

Map a Java class to the Operations object that provides Python semantics to instances of the class.

pack-priv int

Returns:

index in the type (0 if canonical)
getIndex
()

Identify by index which Java implementation of the associated type this Operations object is for.

pack-priv abstract Class<?>

Returns:

class of the implementation
getJavaClass
()

Get the Java implementation class this Operations object is for.

pack-priv boolean

Returns:

target is a data descriptor
isDataDescr
()

Fast check that the target is a data descriptor.

pack-priv boolean

Returns:

target is exactly a Python int
isIntExact
()

Fast check that the target is exactly a Python int.

pack-priv boolean

Returns:

target is a method descriptor
isMethodDescr
()

Fast check that the target is a method descriptor.

pack-priv static Operations

Returns:

Operations providing Python semantics
of
(Object
on which operations are required
obj
)

Map an object to the Operations object that provides it with Python semantics.

pack-priv static void
register(Class<?>
class with which associated
c
,
Operations
the operations object
ops
)

Register the Operations object for a Java class.

pack-priv static void
register(Class<?>[]
classes with which associated
c
,
Operations[]
the operations objects
ops
)

Register the Operations objects for multiple Java classes, as with register(Class, Operations).

pack-priv abstract PyType

Returns:

type(x)
type
(Object
subject of the enquiry
x
)

Get the Python type of the object given that this is the operations object for it.

pack-priv abstract PyType

Returns:

type represented
uniqueType
()

Get the unique Python type for which this is operations object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait