enum
provides a set of structured constants that are
used to refer to the special methods of the Python data model.
These are structured constants that provide not only the
String
method name, but also a signature, and much
information used internally by the run-time system in the
creation of type objects, the interpretation of code and the
creation of call sites.
In principle, any Python object may support all of the special
methods, through "slots" in the Python type object
PyType
. These slots have identical names to the
corresponding constant in this enum
. The "slots" in the
Python type object hold pointers (MethodHandle
s) to their
implementations in Java for that type, which of course define the
behaviour of instances in Python. Where a special method is
absent from the implementation of a type, a default "empty"
handle is provided from the Slot
constant.
Modifier and Type | Class and Description |
---|---|
pack-priv static class | Slot.EmptyException
The type of exception thrown by invoking an empty slot. |
private static class | Slot.MethodNameLookup
Lookup from special method name to |
pack-priv static enum | Slot.Signature
An enumeration of the acceptable signatures for slots in an {link Operations} object. |
private static class |
Modifier and Type | Field and Description |
---|---|
pack-priv final Slot | alt
The alternate slot e.g. |
pack-priv final String | doc
Description to use in help messages |
pack-priv final String | methodName
Name of implementation method to bind e.g. " |
public static final Slot | op_abs
Defines |
public static final Slot | op_add
Defines |
public static final Slot | op_aiter
Defines |
public static final Slot | op_and
Defines |
public static final Slot | op_anext
Defines |
public static final Slot | op_await
Defines |
public static final Slot | op_bool
Defines |
public static final Slot | op_call
Defines |
public static final Slot | op_contains
Defines |
public static final Slot | op_delattr
Defines |
public static final Slot | op_delete
Defines |
public static final Slot | op_delitem
Defines |
public static final Slot | op_divmod
Defines |
public static final Slot | op_eq
Defines |
public static final Slot | op_float
Defines |
public static final Slot | op_floordiv
Defines |
public static final Slot | op_ge
Defines |
public static final Slot | op_get
Defines |
public static final Slot | op_getattr
Defines |
public static final Slot | op_getattribute
Defines |
public static final Slot | op_getitem
Defines |
public static final Slot | op_gt
Defines |
public static final Slot | op_hash
Defines |
public static final Slot | op_iadd
Defines |
public static final Slot | op_iand
Defines |
public static final Slot | op_ifloordiv
Defines |
public static final Slot | op_imatmul
Defines |
public static final Slot | op_imod
Defines |
public static final Slot | op_imul
Defines |
public static final Slot | op_index
Defines |
public static final Slot | op_init
Defines |
public static final Slot | op_int
Defines |
public static final Slot | op_invert
Defines |
public static final Slot | op_ior
Defines |
public static final Slot | op_isub
Defines |
public static final Slot | op_iter
Defines |
public static final Slot | op_itruediv
Defines |
public static final Slot | op_ixor
Defines |
public static final Slot | op_le
Defines |
public static final Slot | op_len
Defines |
public static final Slot | op_lshift
Defines |
public static final Slot | op_lt
Defines |
public static final Slot | op_matmul
Defines |
public static final Slot | op_mod
Defines |
public static final Slot | op_mul
Defines |
public static final Slot | op_ne
Defines |
public static final Slot | op_neg
Defines |
public static final Slot | op_next
Defines |
public static final Slot | op_or
Defines |
public static final Slot | op_pos
Defines |
public static final Slot | op_pow
Defines |
public static final Slot | op_radd
Defines |
public static final Slot | op_rand
Defines |
public static final Slot | op_rdivmod
Defines |
public static final Slot | op_repr
Defines |
public static final Slot | op_rfloordiv
Defines |
public static final Slot | op_rlshift
Defines |
public static final Slot | op_rmatmul
Defines |
public static final Slot | op_rmod
Defines |
public static final Slot | op_rmul
Defines |
public static final Slot | op_ror
Defines |
public static final Slot | op_rpow
Defines |
public static final Slot | op_rrshift
Defines |
public static final Slot | op_rshift
Defines |
public static final Slot | op_rsub
Defines |
public static final Slot | op_rtruediv
Defines |
public static final Slot | op_rxor
Defines |
public static final Slot | op_set
Defines |
public static final Slot | op_setattr
Defines |
public static final Slot | op_setitem
Defines |
public static final Slot | op_str
Defines |
public static final Slot | op_sub
Defines |
public static final Slot | op_truediv
Defines |
public static final Slot | op_xor
Defines |
private MethodHandle | operandError
Handle to throw a |
pack-priv final String | opName
Name to use in error messages, e.g. " |
pack-priv final Slot. | signature
Method signature to match when filling this slot. |
pack-priv final VarHandle | slotHandle
Reference to field holding this slot in an |
Access | Constructor and Description |
---|---|
private | |
private | |
private | |
private |
Modifier and Type | Method and Description |
---|---|
private String | |
public static Slot | Returns: the Slot corresponding, ornull of a (possible) special method name)Lookup by method name, returning |
pack-priv MethodHandle | Returns: current contents of the alternate slot int target operations object ops)Get the |
pack-priv MethodHandle | Returns: empty method handle for this type of slotGet the default that fills the slot when it is "empty". |
pack-priv String | Returns: conventional special method name.Get the name of the method that, by convention, identifies the corresponding operation in the implementing class. |
pack-priv MethodHandle | Returns: throwing method handle for this type of slotGet a handle to throw a |
pack-priv MethodHandle | Returns: current contents of this slot inops target operations object ops)Get the |
pack-priv MethodType | Returns: the invocation type of slots of this name.Return the invocation type of slots of this name. |
pack-priv boolean | Returns: true iff defined (non-empty)to examine for this slot ops)Test whether this slot is non-empty in the given operations object. |
pack-priv void | setDefinition(Operations
target ops, Object Operations (or PyType ).object defining the handle to set (or def)null )Set the |
pack-priv void | setHandle(Operations
target type object ops, MethodHandle handle value to assign mh)Set the |
private static InterpreterError | Returns: exception with message filled inthat the client attempted to set slot, MethodHandle offered value found unsuitable mh)Helper for |
public String | toString()
Overrides java. |
public static Slot | |
public static Slot[] |