Class TypeHierarchy

java.lang.Object
io.helidon.codegen.TypeHierarchy

public final class TypeHierarchy extends Object
Utilities for type hierarchy.
  • Method Details

    • hierarchyAnnotations

      public static List<Annotation> hierarchyAnnotations(CodegenContext ctx, TypeInfo type)
      Find all annotations on the whole type hierarchy. Adds all annotations on the provided type, and all Inherited annotations on supertype(s) and/or interface(s).
      Parameters:
      ctx - codegen context
      type - 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 all Inherited annotations on the same element from supertype(s), and/or interfaces, and/or annotations.

      Based on element type:

      If the same annotation is on multiple levels (i.e. method, super type method, and interface), it will always be used ONLY from the "closest" type - order is: this element, super type element, interface element.
      Parameters:
      ctx - codegen context
      type - type info owning the executable
      element - 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 obtain TypeInfo of types
      type - type info of the processed type
      executable - owner of the parameter (constructor or method)
      parameter - parameter info itself
      parameterIndex - 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

      public static Set<TypeName> nestedAnnotations(CodegenContext ctx, TypeInfo typeInfo)
      Annotations on the typeInfo, it's methods, and method parameters.
      Parameters:
      ctx - context
      typeInfo - type info to check
      Returns:
      a set of all annotation types on any of the elements, including inherited annotations