Top Description Inners Fields Constructors Methods
org.python.core

pack-priv abstract Class Exposer

extends Object
Class Inheritance
Known Direct Subclasses
org.python.core.ModuleExposer, org.python.core.TypeExposer
Imports
java.lang.annotation.Annotation, java.lang.invoke.MethodHandle, .MethodHandles.Lookup, java.lang.reflect.Member, .Method, .Modifier, .Parameter, java.math.BigInteger, java.util.ArrayList, .Collection, .HashMap, .LinkedList, .List, .ListIterator, .Map, .Set, .StringJoiner, .TreeSet, java.util.function.BiConsumer, .Consumer, .Function, org.python.base.InterpreterError, .MethodKind, org.python.core.Exposed.Default, .Exposed.DocString, .Exposed.Getter, .Exposed.KeywordCollector, .Exposed.KeywordOnly, .Exposed.Name, .Exposed.PositionalCollector, .Exposed.PositionalOnly, .Exposed.PythonMethod, .Exposed.PythonStaticMethod, .ModuleDef.MethodDef

An object for tabulating the attributes of classes that define Python types or modules.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv abstract static class
Exposer.BaseMethodSpec

A specialisation of Spec to describe, through one or more Java methods, a named, built-in method-like object, during the exposure process.

pack-priv abstract static class
Exposer.CallableSpec

Specification in which we assemble information about a method in advance of creating a method descriptor or other callable.

pack-priv static class
Exposer.MethodSpec

Specification in which we assemble information about a Python instance method in advance of creating a method definition or method descriptor.

pack-priv abstract static class
Exposer.Spec

The base of classes that describe a named, built-in object, during the exposure process.

pack-priv static class
Exposer.StaticMethodSpec

Specification in which we assemble information about a Python static method in advance of creating a method definition MethodDef or method descriptor PyMethodDescr.

Field Summary

Modifier and TypeField and Description
private static final String
pack-priv final Set<Exposer.CallableSpec>
methodSpecs

The table of intermediate descriptions for methods (instance, static and class).

pack-priv final Map<String, Exposer.Spec>
specs

The index of intermediate descriptions by name, in which we may locate specifications already made or begun, using the name.

Constructor Summary

AccessConstructor and Description
protected
Exposer()

Construct the base with its table of entries.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addMethodSpec(Method
method annotated
meth
,
Exposed.PythonMethod
annotation encountered
anno
)

Process an annotation that identifies a method of a Python type or module defined in Java as one to be exposed to Python, into a specification for a method descriptor, and add it to the table of specifications by name.

pack-priv <
the type of Spec being added or added to.
MS extends Exposer.BaseMethodSpec
>
void
addSpec(Method
the method being adding to the MS
m
,
String
specified in the annotation or null
name
,
Function<Exposer.Spec, MS>
to the MS if possible or null
cast
,
Function<String, MS>
constructor for an MS
makeSpec
,
Consumer<MS>
function to add the MS to the proper list
addSpec
,
BiConsumer<MS, Method>
function to update the MS with a method
addMethod
)

A helper that avoids repeating nearly the same code for adding each particular sub-class of Spec when a method is encountered.

pack-priv void
addStaticMethodSpec(Method
method annotated
meth
,
Exposed.PythonStaticMethod
annotation encountered
anno
)

Process an annotation that identifies a method of a Python type or module defined in Java as one to be exposed to Python, into a specification for a method descriptor, and add it to the table of specifications by name.

pack-priv static InterpreterError

Returns:

the required error
duplicateError
(String
being defined
name
,
Member
field or method annotated
member
,
Exposer.Spec
of the new entry apparently requested
newSpec
,
Exposer.Spec
of the inconsistent, existing entry
priorSpec
)

Create an exception with a message along the lines "'NAME', already exposed as SPEC, cannot be NEW_SPEC" where the place-holders are filled from the corresponding arguments (or their names or type names).

pack-priv static ModuleExposer

Returns:

exposure result
exposeModule
(Class<?>
to introspect for members
definingClass
)

On behalf of the given module defined in Java, build a description of the attributes discovered by introspection of the class provided.

pack-priv static TypeExposer

Returns:

a type exposer able to deliver the attributes
exposeType
(PyType
to which these attributes apply
type
,
Class<?>
to introspect for members
definingClass
,
Class<?>
additional class to introspect for members (or null)
methodClass
)

On behalf of the given type defined in Java, build a description of the attributes discovered by introspection of the class (or classes) provided.

pack-priv abstract ScopeKind

Returns:

which ScopeKind of Exposer is this?
kind
()

pack-priv void
scanJavaMethods(Class<?>
to introspect for definitions
defsClass
)

Add to specs, definitions found in the given class and annotated for exposure.

pack-priv static Collection<Class<?>>

Returns:

super-classes descending to c
superClasses
(Class<?>
given ending class
c
)

Walk down to a given class through all super-classes that might contain items to expose.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait