Top Description Fields Constructors Methods
org.python.core

public abstract Class PyDataDescr

extends PyDescriptor
Class Inheritance
Annotations
@Untraversable
@ExposedType
name:getset_descriptor
base:PyObject
isBaseType:false
Imports
org.python.expose.ExposedGet, .ExposedMethod, .ExposedType

Implements type checking and return type coercion for a data descriptor. A subclass must at least implement invokeGet which is called in __get__ operations. If the descriptor supports setting and deleting, the subclass must also override invokeSet and invokeDel respectively. When implementing those methods, their respective implementsDescr* methods should be overriden as well.

Field Summary

Modifier and TypeField and Description
private String
protected Class<T>
Inherited from org.python.core.PyDescriptor:
dtypename

Constructor Summary

AccessConstructor and Description
public
PyDataDescr(PyType
- the type the descriptor belongs to
onType
,
String
- the name of the descriptor on descriptor type
name
,
Class<T>
- the type returned by the descriptor
ofType
,
String doc)

public
PyDataDescr(String
- the name of the descriptor on descriptor type
name
,
Class<T>
- the type returned by the descriptor
ofType
,
String doc)

This constructor does not initialize the type the descriptor belongs to.

Method Summary

Modifier and TypeMethod and Description
public void
public PyObject
__get__(PyObject
- the instance accessing this descriptor. Can be null if this is being accessed by a type.
obj
,
PyObject
- the type accessing this descriptor. Will be null if obj exists as obj is of the type accessing the descriptor.
type
)

Overrides org.python.core.PyObject.__get__.

Get descriptor for this PyObject.

public void
public String
public String

Returns:

a name String
getName
()

Return the name this descriptor is exposed as.

public PyObject

Returns:

this descriptor's owner
getObjClass
()

Return the owner class of this descriptor.

public void
public PyObject
public void
public void
public abstract Object
public void
invokeSet(PyObject obj, Object converted)

public boolean
public void
setType(PyType onType)

Overrides org.python.core.PyObject.setType.

Sets the type the descriptor belongs to.

public String
toString()

Overrides org.python.core.PyObject.toString.

Returns a string representation of the object.

Inherited from org.python.core.PyDescriptor:
checkCallerTypecheckGetterTyperefersDirectlyTotraverse

Field Detail

docback to summary
private String doc
ofTypeback to summary
protected Class<T> ofType

Constructor Detail

PyDataDescrback to summary
public PyDataDescr(PyType onType, String name, Class<T> ofType, String doc)
Parameters
onType:PyType

- the type the descriptor belongs to

name:String

- the name of the descriptor on descriptor type

ofType:Class<T>

- the type returned by the descriptor

PyDataDescrback to summary
public PyDataDescr(String name, Class<T> ofType, String doc)

This constructor does not initialize the type the descriptor belongs to. setType must be called before this descriptor can be used.

Parameters
name:String

- the name of the descriptor on descriptor type

ofType:Class<T>

- the type returned by the descriptor

Method Detail

__delete__back to summary
public void __delete__(PyObject obj)

Overrides org.python.core.PyObject.__delete__.

Annotations
@Override
__get__back to summary
public PyObject __get__(PyObject obj, PyObject type)

Overrides org.python.core.PyObject.__get__.

Doc from org.python.core.PyObject.__get__.

Get descriptor for this PyObject.

Parameters
obj:PyObject

- the instance accessing this descriptor. Can be null if this is being accessed by a type.

type:PyObject

- the type accessing this descriptor. Will be null if obj exists as obj is of the type accessing the descriptor.

Returns:PyObject

- the object defined for this descriptor for the given obj and type.

Annotations
@Override

__set__back to summary
public void __set__(PyObject obj, PyObject value)

Overrides org.python.core.PyObject.__set__.

Annotations
@Override
getDocback to summary
public String getDoc()
Annotations
@ExposedGet
name:__doc__
getNameback to summary
public String getName()

Return the name this descriptor is exposed as.

Returns:String

a name String

Annotations
@ExposedGet
name:__name__

getObjClassback to summary
public PyObject getObjClass()

Return the owner class of this descriptor.

Returns:PyObject

this descriptor's owner

Annotations
@ExposedGet
name:__objclass__

getset_descriptor___delete__back to summary
public void getset_descriptor___delete__(PyObject obj)
Annotations
@ExposedMethod
getset_descriptor___get__back to summary
public PyObject getset_descriptor___get__(PyObject obj, PyObject type)
Annotations
@ExposedMethod
defaults:null
getset_descriptor___set__back to summary
public void getset_descriptor___set__(PyObject obj, PyObject value)
Annotations
@ExposedMethod
invokeDeleteback to summary
public void invokeDelete(PyObject obj)
invokeGetback to summary
public abstract Object invokeGet(PyObject obj)
invokeSetback to summary
public void invokeSet(PyObject obj, Object converted)
isDataDescrback to summary
public boolean isDataDescr()

Overrides org.python.core.PyObject.isDataDescr.

Annotations
@Override
setTypeback to summary
public void setType(PyType onType)

Overrides org.python.core.PyObject.setType.

Sets the type the descriptor belongs to.

toStringback to summary
public String toString()

Overrides org.python.core.PyObject.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override