Class PyType

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
PyTypeDerived

public class PyType extends PyObject implements Serializable
first-class Python type.
See Also:
  • Field Details

  • Method Details

    • typeSetup

      public static void typeSetup(PyObject dict, PyType.Newstyle marker)
    • type_new

      public static PyObject type_new(PyNewWrapper new_, boolean init, PyType subtype, PyObject[] args, String[] keywords)
    • getStatic

      public PyObject getStatic()
    • layoutAligns

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

      public PyObject getBase()
    • getBases

      public PyObject getBases()
    • delBases

      public void delBases()
    • setBases

      public void setBases(PyObject newBasesTuple)
    • instDict

      public PyObject instDict()
    • getMro

      public PyTuple getMro()
    • type_getSubclasses

      public final PyObject type_getSubclasses()
    • newType

      public static PyObject newType(PyNewWrapper new_, PyType metatype, String name, PyTuple bases, PyObject dict)
    • fastGetName

      public String fastGetName()
    • isSubType

      public boolean isSubType(PyType supertype)
    • lookup

      public PyObject lookup(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(String name, PyObject[] where)
    • super_lookup

      public PyObject super_lookup(PyType ref, String name)
    • fromClass

      public static PyType fromClass(Class c)
    • fastGetDict

      public PyObject fastGetDict()
      Description copied from class: PyObject
      xxx implements where meaningful
      Overrides:
      fastGetDict in class PyObject
      Returns:
      internal object per instance dict or null
      See Also:
    • getDict

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

      public void setDict(PyObject newDict)
      Overrides:
      setDict in class PyObject
    • delDict

      public void delDict()
      Overrides:
      delDict in class PyObject
    • __tojava__

      public Object __tojava__(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 String getFullName()
    • toString

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

      public PyObject __findattr__(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:
    • __delattr__

      public void __delattr__(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:
    • __setattr__

      public void __setattr__(String name, PyObject value)
      Description copied from class: PyObject
      A variant of the __setattr__ method which accepts a String as the key. This String must be interned.
      Overrides:
      __setattr__ in class PyObject
      Parameters:
      name - the name whose value will be set - must be an interned string .
      value - the value to set this name to
      See Also:
    • safeRepr

      public String safeRepr() throws PyIgnoreMethodTag
      Overrides:
      safeRepr in class PyObject
      Throws:
      PyIgnoreMethodTag
      See Also:
    • __call__

      public PyObject __call__(PyObject[] args, 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: