Class GenerationScope
java.lang.Object
io.micronaut.sourcegen.generator.GenerationScope
What the generation of one file resolves against: the outermost definition being written, whose inner types name it
and each other, and the visitor context the file is written with, which knows the types only known by name. A
generator creates one for each file it writes and passes it to the rules that depend on either.
- Since:
- 2.3
-
Method Summary
Modifier and TypeMethodDescription@Nullable ObjectDefdefinitionOf(@Nullable ClassTypeDef owner) The definition a type names, where it is one of the file being written.@Nullable ObjectDefdefinitionOf(@Nullable ClassTypeDef owner, @Nullable ObjectDef current) The definition a method is invoked on, where it is generated: the one the owner names, or the one being written.enclosingVariables(@Nullable ObjectDef definition) The variables of the types enclosing a definition that are in its scope: those of the enclosing class of an inner class - a member class that is not static - and of its enclosing class in turn, the nearest first.static GenerationScopenone()static GenerationScopeof(@Nullable ObjectDef written, @Nullable io.micronaut.inject.visitor.VisitorContext visitorContext) @Nullable io.micronaut.inject.visitor.VisitorContext@Nullable ObjectDefwritten()
-
Method Details
-
none
- Returns:
- The scope of no file: no definition is being written, and no context knows the types named
-
of
public static GenerationScope of(@Nullable ObjectDef written, @Nullable io.micronaut.inject.visitor.VisitorContext visitorContext) - Parameters:
written- The outermost definition of the file being written, ornullvisitorContext- The context the file is written with, ornull- Returns:
- The scope
-
withoutVisitorContext
- Returns:
- The same scope without the visitor context: the definitions of the file alone
-
written
- Returns:
- The outermost definition being written, or
null
-
visitorContext
public @Nullable io.micronaut.inject.visitor.VisitorContext visitorContext()- Returns:
- The context the file is written with, or
null
-
typeLookup
- Returns:
- The lookup of the elements of the context and of the loaded classes
-
hierarchyLookup
- Returns:
- What the hierarchy of a definition is looked up in: the definitions of the file being written - a member type named by its simple name, or naming its enclosing type by name - and the elements of the context
-
definitionsLookup
- Returns:
- The lookup of the definitions of the file being written alone
-
definitionOf
The definition a type names, where it is one of the file being written.- Parameters:
owner- The type, ornull- Returns:
- The definition, or
nullwhere the type is no generated definition
-
definitionOf
The definition a method is invoked on, where it is generated: the one the owner names, or the one being written.- Parameters:
owner- The type declaring the invoked method, ornullcurrent- The definition being written, ornull- Returns:
- The definition, or
nullwhere the owner is no generated definition
-
enclosingVariables
The variables of the types enclosing a definition that are in its scope: those of the enclosing class of an inner class - a member class that is not static - and of its enclosing class in turn, the nearest first. The definitions of the file being written tell which types enclose it.- Parameters:
definition- The definition- Returns:
- The variables, empty for a top level type or a static member
-
elementLookup
-