Descriptor
for a particular definition in Java
of one of the special methods of the Python data model (such as
__sub__
). The type also appears as
<class 'wrapper_descriptor'>
.
The owner of the descriptor is the Python type providing the
definition. Type construction places a PyWrapperDescr
in
the dictionary of the defining PyType
, against a key that
is the "dunder name" of the special method it wraps. (This does
not preclude client code moving it around afterwards!)
The PyWrapperDescr
provides a MethodHandle
for
the defining method. In every Python type where a
PyWrapperDescr
appears as the attribute value
corresponding to a special method, the handle will fill the
corresponding type slot. This may happen because the type is the
defining type, by inheritance, or by insertion of the
PyWrapperDescr
as an attribute of the type. (In the last
case, the signature of the wrapped and destination slots must
match.)
Modifier and Type | Class and Description |
---|---|
pack-priv static class | PyWrapperDescr.Multiple
A |
pack-priv static class | PyWrapperDescr.Single
A |
Modifier and Type | Field and Description |
---|---|
pack-priv final Slot | slot
The |
pack-priv static final PyType |
Access | Constructor and Description |
---|---|
pack-priv | PyWrapperDescr(PyType
the class declaring the special method objclass, Slot for the generic special method slot)Construct a slot wrapper descriptor for the |
Modifier and Type | Method and Description |
---|---|
public Object | |
protected Object | |
protected Object | __get__(Object
object on which the attribute is sought or
obj, PyType null on which this descriptor was found (may be ignored) type)Implements abstract org. __get__ special method of the Python descriptor
protocol, implementing obj.name or possibly
type.name .
|
private Object | |
protected Object | |
public Object | call(Object[]
all arguments given, positional then keyword args, String[] of keyword arguments or names)null Implements org. Object[] and String[] ), providing all the
argument values from the caller and names for those given by
keyword.
|
pack-priv Object | Returns: result of the method calltarget object of the method call self, Object[] of the method call args, String[] of keywords in the method call names)Invoke the method described by this |
pack-priv abstract MethodHandle | Returns: corresponding handle (orslot.getEmpty() )Java class of the selfClass)self argumentReturn the handle contained in this descriptor applicable to the
Java class supplied (typically that of a |
slot | back to summary |
---|---|
pack-priv final Slot slot The |
TYPE | back to summary |
---|---|
pack-priv static final PyType TYPE |
PyWrapperDescr | back to summary |
---|---|
pack-priv PyWrapperDescr(PyType objclass, Slot slot) Construct a slot wrapper descriptor for the |
__call__ | back to summary |
---|---|
public Object __call__(Object[] args, String[] names) throws TypeError, Throwable Call the wrapped method with positional arguments (the first being the target object) and optionally keywords arguments. The arguments, in type and number, must match the signature of the special function slot. |
__doc__ | back to summary |
---|---|
protected Object __doc__() |
__get__ | back to summary |
---|---|
protected Object __get__(Object obj, PyType type) Implements abstract org. Doc from org. The |
__repr__ | back to summary |
---|---|
private Object __repr__()
|
__text_signature__ | back to summary |
---|---|
protected Object __text_signature__() |
call | back to summary |
---|---|
public Object call(Object[] args, String[] names) throws TypeError, Throwable Implements org. Doc from org. Invoke the target object with standard arguments
(
|
callWrapped | back to summary |
---|---|
pack-priv Object callWrapped(Object self, Object[] args, String[] names) throws Throwable Invoke the method described by this |
getWrapped | back to summary |
---|---|
pack-priv abstract MethodHandle getWrapped(Class<?> selfClass) Return the handle contained in this descriptor applicable to the
Java class supplied (typically that of a
|
PyWrapperDescr
for use when the owning Python type has
multiple accepted implementations.
Modifier and Type | Field and Description |
---|---|
protected final MethodHandle[] | wrapped
Handles for the particular implementations of a special method being wrapped. |
Access | Constructor and Description |
---|---|
pack-priv | Multiple(PyType
the class declaring the special method objclass, Slot for the generic special method slot, MethodHandle[] handles to the implementation of that slot wrapped)Construct a slot wrapper descriptor, identifying by an array of
method handles the implementation methods for the |
Modifier and Type | Method and Description |
---|---|
pack-priv MethodHandle | getWrapped(Class<?>
Java class of the selfClass)self argumentImplements abstract org. self argument
during a call).
|
wrapped | back to summary |
---|---|
protected final MethodHandle[] wrapped Handles for the particular implementations of a special method
being wrapped. The method type of each is that of
|
Multiple | back to summary |
---|---|
pack-priv Multiple(PyType objclass, Slot slot, MethodHandle[] wrapped) Construct a slot wrapper descriptor, identifying by an array of
method handles the implementation methods for the
|
getWrapped | back to summary |
---|---|
pack-priv MethodHandle getWrapped(Class<?> selfClass) Implements abstract org. Doc from org. Return the handle contained in this descriptor applicable to the
Java class supplied (typically that of a
The method will check that the type of self matches
|
PyWrapperDescr
for use when the owning Python type has
just one accepted implementation.
Modifier and Type | Field and Description |
---|---|
protected final MethodHandle | wrapped
A handle for the particular implementation of a special method being wrapped. |
Access | Constructor and Description |
---|---|
pack-priv | Single(PyType
the class declaring the special method objclass, Slot for the generic special method slot, MethodHandle a handle to an implementation of that slot wrapped)Construct a slot wrapper descriptor, identifying by a method
handle the implementation method for the |
Modifier and Type | Method and Description |
---|---|
pack-priv MethodHandle | getWrapped(Class<?>
Java class of the selfClass)self argumentImplements abstract org. self argument
during a call).
|
wrapped | back to summary |
---|---|
protected final MethodHandle wrapped A handle for the particular implementation of a special method
being wrapped. The method type is that of
|
Single | back to summary |
---|---|
pack-priv Single(PyType objclass, Slot slot, MethodHandle wrapped) Construct a slot wrapper descriptor, identifying by a method
handle the implementation method for the
|
getWrapped | back to summary |
---|---|
pack-priv MethodHandle getWrapped(Class<?> selfClass) Implements abstract org. Doc from org. Return the handle contained in this descriptor applicable to the
Java class supplied (typically that of a
|