Class PyNewWrapper

All Implemented Interfaces:
Serializable, Cloneable, Traverseproc, org.python.expose.ExposeAsSuperclass
Direct Known Subclasses:
PyOverridableNew

public abstract class PyNewWrapper extends PyBuiltinMethod implements Traverseproc
See Also:
  • Field Details

    • for_type

      public PyType for_type
  • Constructor Details

    • PyNewWrapper

      public PyNewWrapper()
      Creates a wrapper without binding it to a type. setWrappedType must be called before this wrapper can be used.
    • PyNewWrapper

      public PyNewWrapper(Class c, String name, int minargs, int maxargs)
    • PyNewWrapper

      public PyNewWrapper(PyType type, String name, int minargs, int maxargs)
  • Method Details

    • new_impl

      public abstract PyObject new_impl(boolean init, PyType subtype, PyObject[] args, String[] keywords)
    • bind

      public PyBuiltinCallable bind(PyObject self)
      Description copied from class: PyBuiltinCallable
      Returns a new instance of this type of PyBuiltinFunction bound to self
      Overrides:
      bind in class PyBuiltinMethod
    • getWrappedType

      public PyType getWrappedType()
    • setWrappedType

      public void setWrappedType(PyType type)
    • __call__

      public PyObject __call__(PyObject[] args)
      Description copied from class: PyObject
      A variant of the __call__ method when no keywords are passed. The default behavior is to invoke __call__(args, keywords) with the appropriate arguments. The only reason to override this function would be for improved performance.
      Overrides:
      __call__ in class PyObject
      Parameters:
      args - all arguments to the function.
    • __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.
    • 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 PyBuiltinMethod
    • 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 PyBuiltinMethod