Top Description Fields Constructors Methods
org.python.core

pack-priv abstract Class MethodDescriptor

extends Descriptor
implements FastCall
Class Inheritance
All Implemented Interfaces
org.python.core.FastCall
Known Direct Subclasses
org.python.core.PyMethodDescr, org.python.core.PyWrapperDescr
Imports
org.python.core.ArgumentError.Mode

Abstract base class for the descriptor of a method defined in Java. This class provides some common behaviour and support methods that would otherwise be duplicated. This is also home to some static methods in support of both sub-classes and other callable objects (e.g. PyJavaFunction).

Field Summary

Inherited from org.python.core.Descriptor:
DESCRIPTOR_DOESNT_APPLYDESCRIPTOR_NEEDS_ARGUMENTDESCRIPTOR_REQUIRESEMPTYnameobjclassqualname

Constructor Summary

AccessConstructor and Description
pack-priv
MethodDescriptor(PyType descrtype, PyType objclass, String name)

Method Summary

Modifier and TypeMethod and Description
pack-priv static final void
checkArgs(Object[]
positional argument array to be checked
args
,
int
expected number of positional arguments
expArgs
,
String[]
to be checked
names
)

Check the number of positional arguments and that no keywords are supplied.

pack-priv static final void
checkArgs(Object[]
positional argument array to be checked
args
,
int
minimum number of positional arguments
minArgs
,
int
maximum number of positional arguments
maxArgs
,
String[]
to be checked
names
)

Check the number of positional arguments and that no keywords are supplied.

pack-priv static final void
checkArgs(Object[]
positional argument array to be checked
args
,
int
minimum number of positional arguments
minArgs
,
int
maximum number of positional arguments
maxArgs
)

Check that no positional arguments are supplied, when no keyword arguments have been.

pack-priv static final void
checkHasSelf(Object[]
positional argument array to be checked
args
,
String[]
to be taken into account
names
)

Check that at least one argument self has been supplied.

pack-priv static final void
checkNoArgs(Object[]
positional argument array to be checked
args
,
String[]
to be checked
names
)

Check that no positional or keyword arguments are supplied.

pack-priv static final void
checkNoArgs(Object[]
positional argument array to be checked
args
)

Check that no positional arguments are supplied, when no keyword arguments have been.

public TypeError
typeError(ArgumentError
previously thrown by this object
ae
,
Object[]
all arguments given, positional then keyword
args
,
String[]
of keyword arguments or null
names
)

Implements org.python.core.FastCall.typeError.

Translate an ArgumentError that resulted from a call to this FastCall object, and the arguments that were supplied in the call, to a Python TypeError.
Inherited from org.python.core.Descriptor:
__get__checkdescr_get_qualnamedescrReprtoString

Constructor Detail

MethodDescriptorback to summary
pack-priv MethodDescriptor(PyType descrtype, PyType objclass, String name)

Method Detail

checkArgsback to summary
pack-priv static final void checkArgs(Object[] args, int expArgs, String[] names) throws ArgumentError

Check the number of positional arguments and that no keywords are supplied. This is for use when implementing __call__ etc..

Parameters
args:Object[]

positional argument array to be checked

expArgs:int

expected number of positional arguments

names:String[]

to be checked

Exceptions
ArgumentError:
if the wrong number of positional arguments are given or kwargs is not null or empty
checkArgsback to summary
pack-priv static final void checkArgs(Object[] args, int minArgs, int maxArgs, String[] names) throws ArgumentError

Check the number of positional arguments and that no keywords are supplied. This is for use when implementing __call__ etc..

Parameters
args:Object[]

positional argument array to be checked

minArgs:int

minimum number of positional arguments

maxArgs:int

maximum number of positional arguments

names:String[]

to be checked

Exceptions
ArgumentError:
if the wrong number of positional arguments are given or kwargs is not null or empty
checkArgsback to summary
pack-priv static final void checkArgs(Object[] args, int minArgs, int maxArgs) throws ArgumentError

Check that no positional arguments are supplied, when no keyword arguments have been. This is for use when implementing optimised alternatives to __call__.

Parameters
args:Object[]

positional argument array to be checked

minArgs:int

minimum number of positional arguments

maxArgs:int

maximum number of positional arguments

Exceptions
ArgumentError:
if the wrong number of positional arguments are given
checkHasSelfback to summary
pack-priv static final void checkHasSelf(Object[] args, String[] names) throws ArgumentError

Check that at least one argument self has been supplied.

Parameters
args:Object[]

positional argument array to be checked

names:String[]

to be taken into account

Exceptions
ArgumentError:
if self is missing
checkNoArgsback to summary
pack-priv static final void checkNoArgs(Object[] args, String[] names) throws ArgumentError

Check that no positional or keyword arguments are supplied. This is for use when implementing __call__ etc..

Parameters
args:Object[]

positional argument array to be checked

names:String[]

to be checked

Exceptions
ArgumentError:
if positional arguments are given or names is not null or empty
checkNoArgsback to summary
pack-priv static final void checkNoArgs(Object[] args) throws ArgumentError

Check that no positional arguments are supplied, when no keyword arguments have been. This is for use when implementing optimised alternatives to __call__.

Parameters
args:Object[]

positional argument array to be checked

Exceptions
ArgumentError:
if positional arguments are given
typeErrorback to summary
public TypeError typeError(ArgumentError ae, Object[] args, String[] names)

Implements org.python.core.FastCall.typeError.

Doc from org.python.core.FastCall.typeError.

Translate an ArgumentError that resulted from a call to this FastCall object, and the arguments that were supplied in the call, to a Python TypeError.

Any of the optimised call(...), or vectorcall(...) methods in this interface may throw ArgumentError as a shorthand. (This is to keep code short, especially when it is a handle graph.) The caller should catch this close to the call and use this method to swap the ArgumentError for a Python TypeError.

Parameters
ae:ArgumentError

previously thrown by this object

args:Object[]

all arguments given, positional then keyword

names:String[]

of keyword arguments or null

Returns:TypeError

Python TypeError to throw

Annotations
@Override
@SuppressWarnings:fallthrough