Class KotlinComponentInfo
- All Implemented Interfaces:
ComponentRef
The Kotlin counterpart of ComponentInfo, and deliberately much
smaller: it holds the four things an edit needs — the constructor call, the
declaration it is assigned to, the region to search for configuration, and
the name the component goes by — and nothing that would have to be kept in
step with the parse tree afterwards.
Reading and writing need exactly the same resolution, so this is produced
once by KotlinComponentInfoFinder and used by both. Before this
existed the reader resolved the component inline, which meant a writer would
have had to repeat the occurrence and scope rules and could have disagreed
with the panel about which component it was editing.
Public because it appears in KotlinRewriter's signatures, but every
accessor that returns a parse-tree node is package private, so the rule that
no Kt* type escapes this package still holds by compilation rather
than by convention.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanAlways false: a Kotlin component returned from a method rather than attached where it is created is not resolved at all yet, so no instance of this can represent one.booleanisRoute()Class<? extends com.vaadin.flow.component.Component> type()The type as it should be written in source, with any generic arguments the source itself states.The name the source addresses this component by.
-
Method Details
-
type
- Specified by:
typein interfaceComponentRef- Returns:
- the component's runtime type, taken from the live instance rather than parsed from source
-
isReturnValue
public boolean isReturnValue()Always false: a Kotlin component returned from a method rather than attached where it is created is not resolved at all yet, so no instance of this can represent one.- Specified by:
isReturnValuein interfaceComponentRef- Returns:
- true if the component is returned from a method rather than attached where it is created
-
typeWithGenerics
The type as it should be written in source, with any generic arguments the source itself states.Kotlin usually states them on the constructor call —
Grid<Person>()— rather than on the declaration, because the declaration's type is normally inferred. An explicit declaration type wins where there is one, since that is what the developer wrote down.- Specified by:
typeWithGenericsin interfaceComponentRef- Returns:
- the type name
-
variableName
The name the source addresses this component by.- Returns:
- the name, or
nullwhen the component has no name of its own — an inlineadd(Button()), or the view itself, whose properties are set with no receiver at all
-
isRoute
public boolean isRoute()- Returns:
- true if the component is the view itself, constructed by the framework rather than by this source
-