Top Inners Fields Constructors Methods
org.python.core

pack-priv Class TypeExposer

extends Exposer
Class Inheritance
Imports
java.lang.annotation.Annotation, java.lang.invoke.MethodHandle, .MethodHandles.Lookup, .MethodType, .WrongMethodTypeException, java.lang.reflect.Field, .Method, .Modifier, java.util.ArrayList, .EnumSet, .HashMap, .LinkedList, .List, .Map, .Set, .TreeSet, java.util.function.Function, org.python.base.InterpreterError, org.python.core.Exposed.Deleter, .Exposed.DocString, .Exposed.Getter, .Exposed.Member, .Exposed.PythonMethod, .Exposed.PythonStaticMethod, .Exposed.Setter, .Operations.BinopGrid, .PyMemberDescr.Flag, .Slot.Signature

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
TypeExposer.GetSetSpec

A specialisation of Exposer.

pack-priv static class
TypeExposer.MemberSpec

A specialisation of Exposer.

pack-priv static class
TypeExposer.WrapperSpec

Specification in which we assemble information about a Python special method in advance of creating a special method descriptor.

Field Summary

Modifier and TypeField and Description
pack-priv final Set<TypeExposer.GetSetSpec>
getSetSpecs

The table of intermediate descriptions for get-sets.

pack-priv final Set<TypeExposer.MemberSpec>
memberSpecs

The table of intermediate descriptions for members.

pack-priv final PyType
type

Type for which attributes are to be exposed (or null during certain tests).

Inherited from org.python.core.Exposer:
methodSpecsspecs

Constructor Summary

AccessConstructor and Description
pack-priv
TypeExposer(PyType
being exposed
type
)

Construct the TypeExposer instance for a particular Python type.

Method Summary

Modifier and TypeMethod and Description
private void
addDeleter(Method
method annotated
m
,
Exposed.Deleter
annotation encountered
anno
)

Process a method annotated as an exposed attribute get method, into a specification, and find a GetSetSpec to the table of specifications by name (or add one) to hold it.

private void
addGetter(Method
method annotated
m
,
Exposed.Getter
annotation encountered
anno
)

Process a method annotated as an exposed attribute get method, into a specification, and find a GetSetSpec to the table of specifications by name (or add one) to hold it.

pack-priv void
addMemberSpec(Field
field annotated
f
,
Exposed.Member
annotation encountered
anno
)

Process an annotated field, that describes an exposed attribute, into a specification, and add it to the table of specifications by name.

private void
addSetter(Method
method annotated
m
,
Exposed.Setter
annotation encountered
anno
)

Process a method annotated as an exposed attribute set method, into a specification, and find a GetSetSpec to the table of specifications by name (or add one) to hold it.

private void
addWrapperSpec(Method
method annotated
meth
,
Slot
annotation encountered
slot
)

Process a method that matches a slot name to a descriptor specification and add it to the table of specifications by name.

pack-priv static Map<Slot, Operations.BinopGrid>

Returns:

attributes defined (in the order first encountered)
binopTable
(MethodHandles.Lookup
authorisation to access methods
lookup
,
Class<?>
to introspect for binary operations
binops
,
PyType
to which these descriptors apply
type
)

Create a table of MethodHandles from binary operations defined in the given class, on behalf of the type given.

private static void
binopTableAdd(Map<Slot, Operations.BinopGrid>
the method table to add to
defs
,
Slot
being matched
slot
,
Method
implementing method
m
,
MethodHandles.Lookup
authorisation to access fields
lookup
,
Class<?>
class defining class-specific binary operations
binops
,
PyType
to which these belong
type
)

Add a method handle to the table, verifying that the method type produced is compatible with the slot.

private static TypeExposer.GetSetSpec

Returns:

spec or null
castGetSet
(Exposer.Spec
to cast
spec
)

Cast an arbitrary Spec to a GetSetSpec or return null.

pack-priv void
expose(Class<?>
to scan for definitions
definingClass
)

Build the result from the defining class.

pack-priv ScopeKind
kind()

Implements abstract org.python.core.Exposer.kind.

pack-priv void
populate(Map<? super String, Object>
to which the attributes should be delivered
dict
,
MethodHandles.Lookup
authorisation to access members
lookup
)

For each name having a definition in specs, construct the attribute and add it to the map passed in. The map is normally the dictionary of the type.

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

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

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

Overrides org.python.core.Exposer.scanJavaMethods.

Add to specs, definitions based on methods found in the given class and either annotated for exposure or having the name of a special method.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.python.core.Exposer:
addMethodSpecaddSpecaddStaticMethodSpecduplicateErrorexposeModuleexposeTypesuperClasses