java.lang.Object
io.helidon.codegen.TypeHierarchy
Utilities for type hierarchy.
-
Method Summary
Modifier and TypeMethodDescriptionstatic List
<Annotation> hierarchyAnnotations
(CodegenContext ctx, TypeInfo type) Find all annotations on the whole type hierarchy.static List
<Annotation> hierarchyAnnotations
(CodegenContext ctx, TypeInfo type, TypedElementInfo element) Find all annotations on the whole type hierarchy.static List
<Annotation> hierarchyAnnotations
(CodegenContext ctx, TypeInfo type, TypedElementInfo executable, TypedElementInfo parameter, int parameterIndex) Annotations of a parameter, taken from the full inheritance hierarchy (super type(s), interface(s).nestedAnnotations
(CodegenContext ctx, TypeInfo typeInfo) Annotations on thetypeInfo
, it's methods, and method parameters.
-
Method Details
-
hierarchyAnnotations
Find all annotations on the whole type hierarchy. Adds all annotations on the provided type, and allInherited
annotations on supertype(s) and/or interface(s).- Parameters:
ctx
- codegen contexttype
- type info to process- Returns:
- all annotations on the type and in its hierarchy
-
hierarchyAnnotations
public static List<Annotation> hierarchyAnnotations(CodegenContext ctx, TypeInfo type, TypedElementInfo element) Find all annotations on the whole type hierarchy. Adds all annotations on the provided element, and allInherited
annotations on the same element from supertype(s), and/or interfaces, and/or annotations.Based on element type:
- Constructor: only uses annotations from the current element
- Constructor parameter: ditto
- Method: uses annotations from the current element, and from the overridden method/interface method
- Method parameter: use
hierarchyAnnotations(CodegenContext, io.helidon.common.types.TypeInfo, io.helidon.common.types.TypedElementInfo, io.helidon.common.types.TypedElementInfo, int)
instead - Field: only uses annotations from the current element
- Parameters:
ctx
- codegen contexttype
- type info owning the executableelement
- executable (method or constructor) element info- Returns:
- all annotations on the type and in its hierarchy
-
hierarchyAnnotations
public static List<Annotation> hierarchyAnnotations(CodegenContext ctx, TypeInfo type, TypedElementInfo executable, TypedElementInfo parameter, int parameterIndex) Annotations of a parameter, taken from the full inheritance hierarchy (super type(s), interface(s).- Parameters:
ctx
- codegen context to obtainTypeInfo
of typestype
- type info of the processed typeexecutable
- owner of the parameter (constructor or method)parameter
- parameter info itselfparameterIndex
- index of the parameter within the method (as names may be wrong at runtime)- Returns:
- list of annotations on this parameter on this type, super type(s), and interface methods it implements
-
nestedAnnotations
Annotations on thetypeInfo
, it's methods, and method parameters.- Parameters:
ctx
- contexttypeInfo
- type info to check- Returns:
- a set of all annotation types on any of the elements, including inherited annotations
-