Class PyType

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    PyTypeDerived

    public class PyType
    extends PyObject
    implements java.io.Serializable
    first-class Python type.
    See Also:
    Serialized Form
    • Method Detail

      • getStatic

        public PyObject getStatic()
      • layoutAligns

        public boolean layoutAligns​(PyType other)
        Checks that the physical layout between this type and other are compatible.
      • delBases

        public void delBases()
      • setBases

        public void setBases​(PyObject newBasesTuple)
      • type_getSubclasses

        public final PyObject type_getSubclasses()
      • fastGetName

        public java.lang.String fastGetName()
      • isSubType

        public boolean isSubType​(PyType supertype)
      • lookup

        public PyObject lookup​(java.lang.String name)
        INTERNAL lookup for name through mro objects' dicts
        Parameters:
        name - attribute name (must be interned)
        Returns:
        found object or null
      • lookup_where

        public PyObject lookup_where​(java.lang.String name,
                                     PyObject[] where)
      • super_lookup

        public PyObject super_lookup​(PyType ref,
                                     java.lang.String name)
      • fromClass

        public static PyType fromClass​(java.lang.Class c)
      • getDict

        public PyObject getDict()
        Description copied from class: PyObject
        xxx implements where meaningful
        Overrides:
        getDict in class PyObject
        Returns:
        internal object __dict__ or null
      • __tojava__

        public java.lang.Object __tojava__​(java.lang.Class c)
        Description copied from class: PyObject
        Equivalent to the Jython __tojava__ method. Tries to coerce this object to an instance of the requested Java class. Returns the special object Py.NoConversion if this PyObject can not be converted to the desired Java class.
        Overrides:
        __tojava__ in class PyObject
        Parameters:
        c - the Class to convert this PyObject to.
      • getModule

        public PyObject getModule()
      • getNumSlots

        public int getNumSlots()
      • getFullName

        public java.lang.String getFullName()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class PyObject
      • __findattr__

        public PyObject __findattr__​(java.lang.String name)
        Description copied from class: PyObject
        A variant of the __findattr__ method which accepts a Java String as the name. Warning: name must be an interned string!
        Overrides:
        __findattr__ in class PyObject
        Parameters:
        name - the name to lookup in this namespace must be an interned string .
        Returns:
        the value corresponding to name or null if name is not found
        See Also:
        PyObject.__findattr__(java.lang.String)
      • __delattr__

        public void __delattr__​(java.lang.String name)
        Description copied from class: PyObject
        A variant of the __delattr__ method which accepts a String as the key. This String must be interned. By default, this will call __delattr__(PyString name) with the appropriate args. The only reason to override this method is for performance.
        Overrides:
        __delattr__ in class PyObject
        Parameters:
        name - the name which will be removed - must be an interned string .
        See Also:
        PyObject.__delattr__(java.lang.String)
      • __call__

        public PyObject __call__​(PyObject[] args,
                                 java.lang.String[] keywords)
        Description copied from class: PyObject
        The basic method to override when implementing a callable object. The first len(args)-len(keywords) members of args[] are plain arguments. The last len(keywords) arguments are the values of the keyword arguments.
        Overrides:
        __call__ in class PyObject
        Parameters:
        args - all arguments to the function (including keyword arguments).
        keywords - the keywords used for all keyword arguments.
        See Also:
        PyObject.__call__(org.python.core.PyObject[], java.lang.String[])