Class PyMethodDescr

All Implemented Interfaces:
Serializable, PyBuiltinCallable.Info, Traverseproc
Direct Known Subclasses:
PyClassMethodDescr

public class PyMethodDescr extends PyDescriptor implements PyBuiltinCallable.Info, Traverseproc
See Also:
  • Constructor Details

  • Method Details

    • getDoc

      public String getDoc()
    • getMaxargs

      public int getMaxargs()
      Specified by:
      getMaxargs in interface PyBuiltinCallable.Info
    • getMinargs

      public int getMinargs()
      Specified by:
      getMinargs in interface PyBuiltinCallable.Info
    • toString

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

      public PyObject __call__(PyObject[] args, String[] kwargs)
      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).
      kwargs - the keywords used for all keyword arguments.
    • unexpectedCall

      public PyException unexpectedCall(int nargs, boolean keywords)
      Specified by:
      unexpectedCall in interface PyBuiltinCallable.Info
    • __get__

      public PyObject __get__(PyObject obj, PyObject type)
      Description copied from class: PyObject
      Get descriptor for this PyObject.
      Overrides:
      __get__ in class PyObject
      Parameters:
      obj - - the instance accessing this descriptor. Can be null if this is being accessed by a type.
      type - - the type accessing this descriptor. Will be null if obj exists as obj is of the type accessing the descriptor.
      Returns:
      - the object defined for this descriptor for the given obj and type.
    • getName

      public String getName()
      Return the name this descriptor is exposed as.
      Specified by:
      getName in interface PyBuiltinCallable.Info
      Returns:
      a name String
    • getObjClass

      public PyObject getObjClass()
      Return the owner class of this descriptor.
      Returns:
      this descriptor's owner
    • traverse

      public int traverse(Visitproc visit, Object arg)
      Description copied from interface: Traverseproc
      Traverses all directly contained PyObjects. Like in CPython, arg must be passed unmodified to visit as its second parameter. If Visitproc.visit(PyObject, Object) returns nonzero, this return value must be returned immediately by traverse. Visitproc.visit(PyObject, Object) must not be called with a null PyObject-argument.
      Specified by:
      traverse in interface Traverseproc
      Overrides:
      traverse in class PyDescriptor
    • refersDirectlyTo

      public boolean refersDirectlyTo(PyObject ob)
      Description copied from interface: Traverseproc
      Optional operation. Should only be implemented if it is more efficient than calling Traverseproc.traverse(Visitproc, Object) with a visitproc that just watches out for ob. Must return false if ob is null.
      Specified by:
      refersDirectlyTo in interface Traverseproc
      Overrides:
      refersDirectlyTo in class PyDescriptor