Getter
, Setter
and Deleter
that annotate
access methods defined in the object implementation to get, set
or delete the value. PyGetSetDescr
differs from
PyMemberDescr
in giving the author of an implementation
class the power (and responsibility) entirely to define the
behaviour corresponding to these actions.
Modifier and Type | Class and Description |
---|---|
pack-priv static class | PyGetSetDescr.Multiple
A |
pack-priv static class | PyGetSetDescr.Single
A |
pack-priv static enum | PyGetSetDescr.Type
A mapping from symbolic names for the types of method handle in a
|
Modifier and Type | Field and Description |
---|---|
pack-priv static final MethodType | DELETER
The method handle type (O)V. |
pack-priv final String | doc
Documentation string for this attribute. |
private static MethodHandle | EMPTY_DELETER
A handle on |
private static MethodHandle | EMPTY_GETTER
A handle on |
private static MethodHandle[] | EMPTY_MH_ARRAY
Empty array of method handles |
private static MethodHandle | EMPTY_SETTER
A handle on |
pack-priv static final MethodType | GETTER
The method handle type (O)O. |
pack-priv final Class | klass
Java class of attribute accepted by set method. |
pack-priv static final MethodHandles. | |
pack-priv static final MethodType | SETTER
The method handle type (O,O)V. |
pack-priv static final PyType |
Access | Constructor and Description |
---|---|
pack-priv | PyGetSetDescr(PyType
to which descriptor applies objclass, String of attribute name, String documentation string doc, Class<?> Java class of attribute accepted by set method klass)Construct a descriptor that calls the access methods for get, set and delete operations specified as method handles. |
Modifier and Type | Method and Description |
---|---|
pack-priv void | __delete__(Object
object on which the attribute is sought obj)Implements abstract org. __delete__ special method of the Python descriptor
protocol, implementing del obj.name .
|
pack-priv Object | __get__(Object
object on which the attribute is sought or
obj, PyType null is ignored type)Implements abstract org. __get__ special method of the Python descriptor
protocol, implementing obj.name or possibly
type.name .
|
private Object | |
pack-priv void | __set__(Object
object on which the attribute is sought obj, Object to assign (not value)null )Implements abstract org. __set__ special method of the Python descriptor
protocol, implementing obj.name = value .
|
private static void | emptyDeleter(Object
object to operate on ignored)This method fills |
private static Object | Returns: neverobject to operate on ignored)This method fills |
private static void | emptySetter(Object
object to operate on ignored, Object ignored too v)This method fills |
pack-priv static Object | |
pack-priv abstract MethodHandle | Returns: corresponding handle (orslot.getEmpty() )Java class of the selfClass)self argumentReturn the deleter contained in this descriptor applicable to the Java class supplied. |
pack-priv abstract MethodHandle | Returns: corresponding handle (orslot.getEmpty() )Java class of the selfClass)self argumentReturn the getter contained in this descriptor applicable to the Java class supplied. |
pack-priv abstract MethodHandle | Returns: corresponding handle (orslot.getEmpty() )Java class of the selfClass)self argumentReturn the setter contained in this descriptor applicable to the Java class supplied. |
pack-priv abstract boolean | |
pack-priv abstract boolean | Returns: true if the attribute may not be set or deletedThe attribute may not be set or deleted. |
DELETER | back to summary |
---|---|
pack-priv static final MethodType DELETER The method handle type (O)V. |
doc | back to summary |
---|---|
pack-priv final String doc Documentation string for this attribute. |
EMPTY_DELETER | back to summary |
---|---|
private static MethodHandle EMPTY_DELETER A handle on |
EMPTY_GETTER | back to summary |
---|---|
private static MethodHandle EMPTY_GETTER A handle on |
EMPTY_MH_ARRAY | back to summary |
---|---|
private static MethodHandle[] EMPTY_MH_ARRAY Empty array of method handles |
EMPTY_SETTER | back to summary |
---|---|
private static MethodHandle EMPTY_SETTER A handle on |
GETTER | back to summary |
---|---|
pack-priv static final MethodType GETTER The method handle type (O)O. |
klass | back to summary |
---|---|
pack-priv final Class<?> klass Java class of attribute accepted by set method. |
LOOKUP | back to summary |
---|---|
pack-priv static final MethodHandles. |
SETTER | back to summary |
---|---|
pack-priv static final MethodType SETTER The method handle type (O,O)V. |
TYPE | back to summary |
---|---|
pack-priv static final PyType TYPE |
PyGetSetDescr | back to summary |
---|---|
pack-priv PyGetSetDescr(PyType objclass, String name, String doc, Class<?> klass) Construct a descriptor that calls the access methods for get, set and delete operations specified as method handles. |
__delete__ | back to summary |
---|---|
pack-priv void __delete__(Object obj) throws TypeError, Throwable Implements abstract org. Doc from org. The |
__get__ | back to summary |
---|---|
pack-priv Object __get__(Object obj, PyType type) throws Throwable Implements abstract org. Doc from org. The |
__repr__ | back to summary |
---|---|
private Object __repr__()
|
__set__ | back to summary |
---|---|
pack-priv void __set__(Object obj, Object value) throws TypeError, Throwable Implements abstract org. Doc from org. The |
emptyDeleter | back to summary |
---|---|
private static void emptyDeleter(Object ignored) throws EmptyException This method fills
|
emptyGetter | back to summary |
---|---|
private static Object emptyGetter(Object ignored) throws EmptyException This method fills
|
emptySetter | back to summary |
---|---|
private static void emptySetter(Object ignored, Object v) throws EmptyException This method fills
|
getset_get_doc | back to summary |
---|---|
pack-priv static Object getset_get_doc(PyGetSetDescr descr) |
getWrappedDelete | back to summary |
---|---|
pack-priv abstract MethodHandle getWrappedDelete(Class<?> selfClass) Return the deleter contained in this descriptor applicable to the
Java class supplied. The
|
getWrappedGet | back to summary |
---|---|
pack-priv abstract MethodHandle getWrappedGet(Class<?> selfClass) Return the getter contained in this descriptor applicable to the
Java class supplied. The
|
getWrappedSet | back to summary |
---|---|
pack-priv abstract MethodHandle getWrappedSet(Class<?> selfClass) Return the setter contained in this descriptor applicable to the
Java class supplied. The
|
optional | back to summary |
---|---|
pack-priv abstract boolean optional() The attribute may be deleted.
|
readonly | back to summary |
---|---|
pack-priv abstract boolean readonly() The attribute may not be set or deleted.
|
PyGetSetDescr
to use for a get-set attribute when the
owning Python type has multiple accepted implementations.
Modifier and Type | Field and Description |
---|---|
protected final MethodHandle[] | delete
Handles for the particular implementations of the deleter. |
protected final MethodHandle[] | get
Handles for the particular implementations of the getter. |
protected final MethodHandle[] | set
Handles for the particular implementations of the setter. |
Access | Constructor and Description |
---|---|
pack-priv | Multiple(PyType
to which descriptor applies objclass, String of attribute name, MethodHandle[] operation get, MethodHandle[] operation set, MethodHandle[] operation delete, String documentation string doc, Class<?> Java class of attribute accepted by set method klass)Construct a get-set descriptor, identifying by an array of method
handles the implementation methods applicable to
|
Modifier and Type | Method and Description |
---|---|
pack-priv MethodHandle | getWrappedDelete(Class<?>
Java class of the selfClass)self argumentImplements abstract org. |
pack-priv MethodHandle | getWrappedGet(Class<?>
Java class of the selfClass)self argumentImplements abstract org. |
pack-priv MethodHandle | getWrappedSet(Class<?>
Java class of the selfClass)self argumentImplements abstract org. |
pack-priv boolean | |
pack-priv boolean | readonly()
Implements abstract org. |
delete | back to summary |
---|---|
protected final MethodHandle[] delete Handles for the particular implementations of the deleter. The
method type of each is |
get | back to summary |
---|---|
protected final MethodHandle[] get Handles for the particular implementations of the getter. The
method type of each is |
set | back to summary |
---|---|
protected final MethodHandle[] set Handles for the particular implementations of the setter. The
method type of each is |
Multiple | back to summary |
---|---|
pack-priv Multiple(PyType objclass, String name, MethodHandle[] get, MethodHandle[] set, MethodHandle[] delete, String doc, Class<?> klass) Construct a get-set descriptor, identifying by an array of method
handles the implementation methods applicable to
|
getWrappedDelete | back to summary |
---|---|
pack-priv MethodHandle getWrappedDelete(Class<?> selfClass) Implements abstract org. Doc from org. Return the deleter contained in this descriptor applicable to the
Java class supplied. The
The method will check that the type of self matches
|
getWrappedGet | back to summary |
---|---|
pack-priv MethodHandle getWrappedGet(Class<?> selfClass) Implements abstract org. Doc from org. Return the getter contained in this descriptor applicable to the
Java class supplied. The
The method will check that the type of self matches
|
getWrappedSet | back to summary |
---|---|
pack-priv MethodHandle getWrappedSet(Class<?> selfClass) Implements abstract org. Doc from org. Return the setter contained in this descriptor applicable to the
Java class supplied. The
The method will check that the type of self matches
|
optional | back to summary |
---|---|
pack-priv boolean optional() Implements abstract org. Doc from org. The attribute may be deleted.
|
readonly | back to summary |
---|---|
pack-priv boolean readonly() Implements abstract org. Doc from org. The attribute may not be set or deleted.
|
PyGetSetDescr
to use for a get-set attribute when the
owning Python type has just one accepted implementation.
Modifier and Type | Field and Description |
---|---|
pack-priv final MethodHandle | delete
A handle on the deleter defined by the unique implementation of
|
pack-priv final MethodHandle | get
A handle on the getter defined by the unique implementation of
|
pack-priv final MethodHandle | set
A handle on the setter defined by the unique implementation of
|
Access | Constructor and Description |
---|---|
pack-priv | Single(PyType
to which descriptor applies objclass, String of attribute name, MethodHandle handle on getter method (or get, MethodHandle null )handle on setter method (or set, MethodHandle null )handle on deleter method (or delete, String null )documentation string doc, Class<?> Java class of attribute accepted by set method klass)Construct a get-set descriptor, identifying by a method handle
each implementation method applicable to |
Modifier and Type | Method and Description |
---|---|
pack-priv MethodHandle | getWrappedDelete(Class<?>
Java class of the selfClass)self argumentImplements abstract org. |
pack-priv MethodHandle | getWrappedGet(Class<?>
Java class of the selfClass)self argumentImplements abstract org. |
pack-priv MethodHandle | getWrappedSet(Class<?>
Java class of the selfClass)self argumentImplements abstract org. |
pack-priv boolean | |
pack-priv boolean | readonly()
Implements abstract org. |
delete | back to summary |
---|---|
pack-priv final MethodHandle delete A handle on the deleter defined by the unique implementation of
|
get | back to summary |
---|---|
pack-priv final MethodHandle get A handle on the getter defined by the unique implementation of
|
set | back to summary |
---|---|
pack-priv final MethodHandle set A handle on the setter defined by the unique implementation of
|
Single | back to summary |
---|---|
pack-priv Single(PyType objclass, String name, MethodHandle get, MethodHandle set, MethodHandle delete, String doc, Class<?> klass) Construct a get-set descriptor, identifying by a method handle
each implementation method applicable to
|
getWrappedDelete | back to summary |
---|---|
pack-priv MethodHandle getWrappedDelete(Class<?> selfClass) Implements abstract org. Doc from org. Return the deleter contained in this descriptor applicable to the
Java class supplied. The
|
getWrappedGet | back to summary |
---|---|
pack-priv MethodHandle getWrappedGet(Class<?> selfClass) Implements abstract org. Doc from org. Return the getter contained in this descriptor applicable to the
Java class supplied. The
|
getWrappedSet | back to summary |
---|---|
pack-priv MethodHandle getWrappedSet(Class<?> selfClass) Implements abstract org. Doc from org. Return the setter contained in this descriptor applicable to the
Java class supplied. The
|
optional | back to summary |
---|---|
pack-priv boolean optional() Implements abstract org. Doc from org. The attribute may be deleted.
|
readonly | back to summary |
---|---|
pack-priv boolean readonly() Implements abstract org. Doc from org. The attribute may not be set or deleted.
|
PyGetSetDescr
to other properties like the method handle
type.
Modifier and Type | Field and Description |
---|---|
public static final PyGetSetDescr. | |
public static final PyGetSetDescr. | |
pack-priv final MethodType | |
public static final PyGetSetDescr. |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
pack-priv static PyGetSetDescr. | Returns: matching type ornull to match mt)Map the method handle type back to the |
public static PyGetSetDescr. | |
public static PyGetSetDescr. |
Deleter | back to summary |
---|---|
public static final PyGetSetDescr. |
Getter | back to summary |
---|---|
public static final PyGetSetDescr. |
methodType | back to summary |
---|---|
pack-priv final MethodType methodType |
Setter | back to summary |
---|---|
public static final PyGetSetDescr. |
Type | back to summary |
---|---|
private Type(MethodType mt) |
fromMethodType | back to summary |
---|---|
pack-priv static PyGetSetDescr. Map the method handle type back to the
|
valueOf | back to summary |
---|---|
public static PyGetSetDescr. |
values | back to summary |
---|---|
public static PyGetSetDescr. |