Class AnnotatedTypes

java.lang.Object
io.activej.types.AnnotatedTypes

public class AnnotatedTypes extends Object
Various utility methods to operate on annotated types
  • Field Details

  • Constructor Details

    • AnnotatedTypes

      public AnnotatedTypes()
  • Method Details

    • getRawType

      public static Class<?> getRawType(AnnotatedType type)
      Returns a raw Class for a given AnnotatedType
      See Also:
    • getTypeArguments

      public static AnnotatedType[] getTypeArguments(AnnotatedType annotatedType)
      Returns an array of annotated type arguments for a given AnnotatedType
      Parameters:
      annotatedType - annotated type whose annotated type arguments should be retrieved
      Returns:
      an array of annotated type arguments for a given AnnotatedType
    • getTypeBindings

      public static Map<TypeVariable<?>,AnnotatedType> getTypeBindings(AnnotatedType type)
      Returns a map of type bindings for a given AnnotatedType
    • bind

      public static AnnotatedType bind(AnnotatedType annotatedType, Function<TypeVariable<?>,AnnotatedType> bindings)
      Binds a given annotated type with actual annotated type arguments
      Parameters:
      annotatedType - an annotated type to be bound
      bindings - a lookup function for actual annotated types
    • bind

      public static AnnotatedType bind(AnnotatedType annotatedType, Function<TypeVariable<?>,AnnotatedType> bindings, BinaryOperator<Annotation[]> annotationCombinerFn)
      Binds a given annotated type with actual annotated type arguments
      Parameters:
      annotatedType - an annotated type to be bound
      bindings - a lookup function for actual annotated types
      annotationCombinerFn - a combiner function to combine annotations of a given annotated type with annotations of bound actual annotated type
    • annotatedTypeOf

      public static AnnotatedType annotatedTypeOf(Type type)
      Constructs an AnnotatedType from a given Type. Resulting annotated type has no annotations
      Parameters:
      type - a type to construct annotated type from
      Returns:
      a new instance of AnnotatedType
    • annotatedTypeOf

      public static AnnotatedType annotatedTypeOf(Type type, Annotation[] annotations)
      Constructs an AnnotatedType from a given Type and an array of annotations.
      Parameters:
      type - a type to construct annotated type from
      annotations - an array of annotations for a given type
      Returns:
      a new instance of AnnotatedType
    • annotatedTypeOf

      public static AnnotatedType annotatedTypeOf(Type type, BiFunction<Type,int[],Annotation[]> annotationsFn)
      Constructs an AnnotatedType from a given Type and a function that transforms a type and a path to the type into annotations for this type.

      This method allows building complex annotated types

      Parameters:
      type - a type to construct annotated type from
      annotationsFn - a function that transforms a type and a path to the type into annotations for this type
      Returns:
      a new instance of AnnotatedType