Class PythonStubGenerator
java.lang.Object
io.micronaut.python.processing.PythonStubGenerator
- All Implemented Interfaces:
Ordered, Toggleable, TypeElementVisitor<Object,Object>
Generates Java stubs for Python classes, scripts, enums, interfaces, and annotations.
-
Nested Class Summary
Nested classes/interfaces inherited from interface TypeElementVisitor
TypeElementVisitor.VisitorKind -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final io.micronaut.sourcegen.model.VariableDef.StaticFieldstatic final Stringstatic final Stringstatic final io.micronaut.sourcegen.model.ClassTypeDefThe type of a proxy that intercepts a target bean; a generated stub that is one has no Python object of its own.static final Stringstatic final io.micronaut.sourcegen.model.TypeDefstatic final io.micronaut.sourcegen.model.TypeDefstatic final io.micronaut.sourcegen.model.ClassTypeDefstatic final io.micronaut.sourcegen.model.ClassTypeDefstatic final io.micronaut.sourcegen.model.ClassTypeDefstatic final io.micronaut.sourcegen.model.ClassTypeDefstatic final io.micronaut.sourcegen.model.ClassTypeDefstatic final io.micronaut.sourcegen.model.ClassTypeDefstatic final io.micronaut.sourcegen.model.ClassTypeDefstatic final io.micronaut.sourcegen.model.ClassTypeDefstatic final io.micronaut.sourcegen.model.ClassTypeDefstatic final io.micronaut.sourcegen.model.ClassTypeDefstatic final io.micronaut.sourcegen.model.ClassTypeDefstatic final io.micronaut.sourcegen.model.ClassTypeDefstatic final Stringstatic final io.micronaut.sourcegen.model.ClassTypeDefFields inherited from interface Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbridgeProducerMethod(PythonMethodElement producerMethod, VisitorContext visitorContext) Bridges a producer method of an associated bean into the stub of the Python class that declares it.voidfinish(VisitorContext visitorContext) Called once when visitor processing finishes.The annotation processor options this visitor reads, so that javac does not report them as options no processor recognized - a warning, and with-Werrora compilation error, for a user who passes one of them.query()The query which allows to reduce the scope which the visitor is visiting.voidstart(VisitorContext visitorContext) Called once when visitor processing starts.voidvisitClass(ClassElement element, VisitorContext context) Executed when a class is encountered that matches the <C> generic.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Toggleable
isEnabledMethods inherited from interface TypeElementVisitor
getClassType, getElementType, getSupportedAnnotationNames, visitConstructor, visitEnumConstant, visitField, visitMethod
-
Field Details
-
POLYGLOT_VALUE
public static final io.micronaut.sourcegen.model.TypeDef POLYGLOT_VALUE -
POLYGLOT_CONTEXT
public static final io.micronaut.sourcegen.model.TypeDef POLYGLOT_CONTEXT -
CLASS_OBJECT
public static final io.micronaut.sourcegen.model.VariableDef.StaticField CLASS_OBJECT -
AS_POLYGLOT_VALUE
- See Also:
-
RECONSTRUCT_POLYGLOT_VALUE
- See Also:
-
FROM_POLYGLOT_VALUE
- See Also:
-
PYTHON_COERCION
public static final io.micronaut.sourcegen.model.ClassTypeDef PYTHON_COERCION -
VALUE_COERCIBLES
public static final io.micronaut.sourcegen.model.ClassTypeDef VALUE_COERCIBLES -
PYTHON_CONVERSION
public static final io.micronaut.sourcegen.model.ClassTypeDef PYTHON_CONVERSION -
PYTHON_EXCEPTIONS
public static final io.micronaut.sourcegen.model.ClassTypeDef PYTHON_EXCEPTIONS -
PYTHON_HTTP_CONVERSION
public static final io.micronaut.sourcegen.model.ClassTypeDef PYTHON_HTTP_CONVERSION -
PYTHON_INVOCATION
public static final io.micronaut.sourcegen.model.ClassTypeDef PYTHON_INVOCATION -
PYTHON_ASYNCIO_RUNTIME
public static final io.micronaut.sourcegen.model.ClassTypeDef PYTHON_ASYNCIO_RUNTIME -
PYTHON_CONTEXT_RUNTIME
public static final io.micronaut.sourcegen.model.ClassTypeDef PYTHON_CONTEXT_RUNTIME -
PYTHON_JAVA_BASES
public static final io.micronaut.sourcegen.model.ClassTypeDef PYTHON_JAVA_BASES -
PYTHON_CLASS_REFERENCE
public static final io.micronaut.sourcegen.model.ClassTypeDef PYTHON_CLASS_REFERENCE -
PYTHON_CLASS_ANNOTATION
public static final io.micronaut.sourcegen.model.ClassTypeDef PYTHON_CLASS_ANNOTATION -
PYTHON_MODULE_ANNOTATION
public static final io.micronaut.sourcegen.model.ClassTypeDef PYTHON_MODULE_ANNOTATION -
POLYGLOT_VALUE_CONVERTER
public static final io.micronaut.sourcegen.model.ClassTypeDef POLYGLOT_VALUE_CONVERTER -
INTERCEPTED_PROXY
public static final io.micronaut.sourcegen.model.ClassTypeDef INTERCEPTED_PROXYThe type of a proxy that intercepts a target bean; a generated stub that is one has no Python object of its own. -
GENERATOR_NAME
- See Also:
-
JUNIT_TEST
- See Also:
-
ANN_JSON_PROPERTY
- See Also:
-
ANN_JSON_CREATOR
- See Also:
-
-
Constructor Details
-
PythonStubGenerator
public PythonStubGenerator()
-
-
Method Details
-
query
Description copied from interface:TypeElementVisitorThe query which allows to reduce the scope which the visitor is visiting.- Specified by:
queryin interfaceTypeElementVisitor<Object,Object> - Returns:
- The query if the visitor.
-
getSupportedOptions
The annotation processor options this visitor reads, so that javac does not report them as options no processor recognized - a warning, and with-Werrora compilation error, for a user who passes one of them.Declaring an option here is also what makes it settable from an application's configuration under Pyronaut, which passes every supported option it finds in
application.tomlthrough as-A. An option the visitor reads but does not declare can only be set by hand.- Specified by:
getSupportedOptionsin interfaceTypeElementVisitor<Object,Object> - Returns:
- The names of the
-Aoptions this visitor reads
-
finish
Description copied from interface:TypeElementVisitorCalled once when visitor processing finishes.- Specified by:
finishin interfaceTypeElementVisitor<Object,Object> - Parameters:
visitorContext- The visitor context
-
start
Description copied from interface:TypeElementVisitorCalled once when visitor processing starts.- Specified by:
startin interfaceTypeElementVisitor<Object,Object> - Parameters:
visitorContext- The visitor context
-
visitClass
Description copied from interface:TypeElementVisitorExecuted when a class is encountered that matches the <C> generic.- Specified by:
visitClassin interfaceTypeElementVisitor<Object,Object> - Parameters:
element- The elementcontext- The visitor context
-
bridgeProducerMethod
Bridges a producer method of an associated bean into the stub of the Python class that declares it. The child bean definition written for the method invokes it on the generated Java class, and a Python method is only bridged into the stub when Micronaut needs to see it.- Parameters:
producerMethod- The producer method registered withBeanElementBuilder.produceBeans(...)visitorContext- The visitor context
-
getVisitorKind
- Specified by:
getVisitorKindin interfaceTypeElementVisitor<Object,Object> - Returns:
- The visitor kind.
-