Class Reflection2Gizmo

java.lang.Object
io.quarkus.gizmo2.Reflection2Gizmo

public final class Reflection2Gizmo extends Object
Bridge methods from java.lang.reflect types to the Gizmo API.
  • Constructor Details

    • Reflection2Gizmo

      public Reflection2Gizmo()
  • Method Details

    • classDescOf

      public static ClassDesc classDescOf(Class<?> clazz)
      Returns a ClassDesc for the given clazz.
      Parameters:
      clazz - the class (must not be null)
      Returns:
      the ClassDesc (not null)
    • equals

      public static boolean equals(ClassDesc d1, ClassDesc d2)
      Returns true if the two descriptors are equal, or false if they are not. Generally more efficient than calling ClassDesc.equals(other) on the descriptor itself.
      Returns:
      true if the two descriptors are equal, or false if they are not
    • erasureOf

      public static ClassDesc erasureOf(Type type)
      Returns an erasure of the given type.
      Parameters:
      type - the type (must not be null)
      Returns:
      an erasure of the given type
    • genericTypeOf

      public static GenericType genericTypeOf(Type type)
      Returns the given reflection type as a generic type (not null).
      Parameters:
      type - the type (must not be null)
      Returns:
      the given reflection type as a generic type (not null)
      Throws:
      IllegalArgumentException - if the given type is a wildcard type or is not recognized
    • genericTypeOf

      public static GenericType.OfArray genericTypeOf(GenericArrayType type)
      Returns the given array reflection type as a generic type (not null).
      Parameters:
      type - the type (must not be null)
      Returns:
      the given array reflection type as a generic type (not null)
    • genericTypeOf

      public static GenericType.OfTypeVariable genericTypeOf(TypeVariable<?> type)
      Returns the given type variable reflection type as a generic type (not null).
      Parameters:
      type - the type variable (must not be null)
      Returns:
      the given type variable reflection type as a generic type (not null)
    • genericTypeOf

      public static GenericType.OfClass genericTypeOf(ParameterizedType type)
      Returns the given parameterized reflection type as a generic type (not null).
      Parameters:
      type - the type (must not be null)
      Returns:
      the given parameterized reflection type as a generic type (not null)
    • genericTypeOf

      public static GenericType genericTypeOf(AnnotatedType type)
      Returns the given annotated reflection type as a generic type (not null).
      Parameters:
      type - the type (must not be null)
      Returns:
      the given annotated reflection type as a generic type (not null)
      Throws:
      IllegalArgumentException - if the given type is a wildcard type or is not recognized
    • genericTypeOf

      public static GenericType.OfArray genericTypeOf(AnnotatedArrayType type)
      Returns the given annotated array reflection type as a generic type (not null).
      Parameters:
      type - the type (must not be null)
      Returns:
      the given annotated array reflection type as a generic type (not null)
    • genericTypeOf

      public static GenericType genericTypeOf(AnnotatedParameterizedType type)
      Returns the given annotated parameterized type as a generic type (not null).
      Parameters:
      type - the type (must not be null)
      Returns:
      the given annotated parameterized type as a generic type (not null)
    • genericTypeOf

      public static GenericType.OfTypeVariable genericTypeOf(AnnotatedTypeVariable type)
      Returns the given type variable annotated reflection type as a generic type (not null).
      Parameters:
      type - the type variable (must not be null)
      Returns:
      the given type variable annotated reflection type as a generic type (not null)
    • typeParameterOf

      public static TypeParameter typeParameterOf(TypeVariable<?> typeVar)
      Returns a type parameter for the given type variable.
      Parameters:
      typeVar - the type variable (must not be null)
      Returns:
      a type parameter for the given type variable
    • typeArgumentOf

      public static TypeArgument typeArgumentOf(Type type)
      Returns a type argument for the given generic reflection type.
      Parameters:
      type - the argument type (must not be null)
      Returns:
      a type argument for the given generic reflection type
    • typeArgumentOf

      public static TypeArgument.OfWildcard typeArgumentOf(WildcardType type)
      Returns a type argument for the given reflection wildcard type.
      Parameters:
      type - the argument type (must not be null)
      Returns:
      a type argument for the given reflection wildcard type
    • typeArgumentOf

      public static TypeArgument typeArgumentOf(AnnotatedType type)
      Returns a type argument for the given annotated generic reflection type. If the type is an annotated wildcard type, then the type argument will be a wildcard type with any annotations attached to the given type. Otherwise, the result will be an exact type argument whose type will have any annotations attached to the given type.
      Parameters:
      type - the argument type (must not be null)
      Returns:
      a type argument for the given annotated generic reflection type
    • typeArgumentOf

      public static TypeArgument.OfWildcard typeArgumentOf(AnnotatedWildcardType type)
      Returns a type argument for the given annotated reflection wildcard type.
      Parameters:
      type - the argument type (must not be null)
      Returns:
      a type argument for the given annotated reflection wildcard type
    • copyAnnotations

      public static Consumer<AnnotatableCreator> copyAnnotations(AnnotatedElement element)
      Copy all of the annotations from the given annotated element.
      Parameters:
      element - the annotated element (must not be null)
      Returns:
      a consumer which copies the annotations (not null)