Top Description Fields Constructors Methods
org.python.core

pack-priv abstract Class DataDescriptor

extends Descriptor
Class Inheritance
Known Direct Subclasses
org.python.core.PyGetSetDescr, org.python.core.PyMemberDescr

Base class of built-in data descriptors.

Field Summary

Inherited from org.python.core.Descriptor:
DESCRIPTOR_DOESNT_APPLYDESCRIPTOR_NEEDS_ARGUMENTDESCRIPTOR_REQUIRESEMPTYnameobjclassqualname

Constructor Summary

AccessConstructor and Description
pack-priv
DataDescriptor(PyType
actual Python type of descriptor
descrtype
,
PyType
to which the descriptor applies
objclass
,
String
of the attribute
name
)

Create the common part of DataDescriptor sub-classes.

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract void
__delete__(Object
object on which the attribute is sought
obj
)

The __delete__ special method of the Python descriptor protocol, implementing del obj.name.

pack-priv abstract void
__set__(Object
object on which the attribute is sought
obj
,
Object
to assign (not null)
value
)

The __set__ special method of the Python descriptor protocol, implementing obj.name = value.

protected TypeError

Returns:

exception to throw
attrMustBe
(String
expected kind of thing
kind
,
Object
provided to set this attribute in some object
value
)

Create a TypeError with a message along the lines "'N' must be T, not 'X' as received" involving the name N of the attribute, any descriptive phrase T and the type X of value, e.g. "'__dict__' must be a dictionary, not 'list' as received".

protected TypeError

Returns:

exception to throw
attrMustBe
(Class<?>
expected kind of thing
attrClass
,
Object
provided to set this attribute in some object
value
)

Create a TypeError with a message along the lines "'N' must be T, not 'X' as received" involving the name N of the attribute, a description T based on the expected Java class attrClass, and the type X of value, e.g. "'__dict__' must be a dictionary, not 'list' as received".

protected TypeError

Returns:

exception to throw
cannotDeleteAttr
()

Create a TypeError with a message along the lines "cannot delete attribute N from 'T' objects" involving the name N of this attribute and the type T which is Descriptor#objclass, e.g. "cannot delete attribute f_trace_lines from 'frame' objects".

protected AttributeError

Returns:

exception to throw
cannotReadAttr
()

Create an AttributeError with a message along the lines "attribute 'N' of 'T' objects is not readable" involving the name N of this attribute and the type T which is Descriptor#objclass.

protected AttributeError

Returns:

exception to throw
cannotWriteAttr
()

Create an AttributeError with a message along the lines "attribute 'N' of 'T' objects is not writable" involving the name N of this attribute and the type T which is Descriptor#objclass.

protected void
checkDelete(Object
target object (argument to __delete__)
obj
)

descr.__delete__(obj) has been called on this descriptor.

protected void
checkSet(Object
target object (argument to __set__)
obj
)

descr.__set__(obj, value) has been called on this descriptor.

Inherited from org.python.core.Descriptor:
__get__checkdescr_get_qualnamedescrReprtoString

Constructor Detail

DataDescriptorback to summary
pack-priv DataDescriptor(PyType descrtype, PyType objclass, String name)

Create the common part of DataDescriptor sub-classes.

Parameters
descrtype:PyType

actual Python type of descriptor

objclass:PyType

to which the descriptor applies

name:String

of the attribute

Method Detail

__delete__back to summary
pack-priv abstract void __delete__(Object obj) throws TypeError, Throwable

The __delete__ special method of the Python descriptor protocol, implementing del obj.name. In general, obj must be of type objclass.

Parameters
obj:Object

object on which the attribute is sought

Exceptions
Throwable:
from the implementation of the deleter
__set__back to summary
pack-priv abstract void __set__(Object obj, Object value) throws TypeError, Throwable

The __set__ special method of the Python descriptor protocol, implementing obj.name = value. In general, obj must be of type objclass.

Parameters
obj:Object

object on which the attribute is sought

value:Object

to assign (not null)

Exceptions
Throwable:
from the implementation of the setter
attrMustBeback to summary
protected TypeError attrMustBe(String kind, Object value)

Create a TypeError with a message along the lines "'N' must be T, not 'X' as received" involving the name N of the attribute, any descriptive phrase T and the type X of value, e.g. "'__dict__' must be a dictionary, not 'list' as received".

Parameters
kind:String

expected kind of thing

value:Object

provided to set this attribute in some object

Returns:TypeError

exception to throw

attrMustBeback to summary
protected TypeError attrMustBe(Class<?> attrClass, Object value)

Create a TypeError with a message along the lines "'N' must be T, not 'X' as received" involving the name N of the attribute, a description T based on the expected Java class attrClass, and the type X of value, e.g. "'__dict__' must be a dictionary, not 'list' as received".

Parameters
attrClass:Class<?>

expected kind of thing

value:Object

provided to set this attribute in some object

Returns:TypeError

exception to throw

cannotDeleteAttrback to summary
protected TypeError cannotDeleteAttr()

Create a TypeError with a message along the lines "cannot delete attribute N from 'T' objects" involving the name N of this attribute and the type T which is Descriptor#objclass, e.g. "cannot delete attribute f_trace_lines from 'frame' objects".

Returns:TypeError

exception to throw

cannotReadAttrback to summary
protected AttributeError cannotReadAttr()

Create an AttributeError with a message along the lines "attribute 'N' of 'T' objects is not readable" involving the name N of this attribute and the type T which is Descriptor#objclass.

Returns:AttributeError

exception to throw

cannotWriteAttrback to summary
protected AttributeError cannotWriteAttr()

Create an AttributeError with a message along the lines "attribute 'N' of 'T' objects is not writable" involving the name N of this attribute and the type T which is Descriptor#objclass.

Returns:AttributeError

exception to throw

checkDeleteback to summary
protected void checkDelete(Object obj) throws TypeError

descr.__delete__(obj) has been called on this descriptor. We must check that the descriptor applies to the type of object supplied as the obj argument. From Python, anything could be presented, but when we operate on it, we'll be assuming the particular objclass type.

Parameters
obj:Object

target object (argument to __delete__)

checkSetback to summary
protected void checkSet(Object obj) throws TypeError

descr.__set__(obj, value) has been called on this descriptor. We must check that the descriptor applies to the type of object supplied as the obj argument. From Python, anything could be presented, but when we operate on it, we'll be assuming the particular objclass type.

Parameters
obj:Object

target object (argument to __set__)

Exceptions
TypeError:
if descriptor doesn't apply to obj