Class GenericType.OfClass

Direct Known Subclasses:
GenericType.OfInnerClass, GenericType.OfRootClass
Enclosing class:
GenericType

public abstract static class GenericType.OfClass extends GenericType.OfThrows
A generic type of a class or interface (including specialized cases: enums, records, or annotations). Includes all of non-generic class types, parameterized types (generic class types with type arguments) and raw types (generic class types without type arguments).
  • Method Details

    • typeArguments

      public List<TypeArgument> typeArguments()
      Returns the list of type arguments (not null).
      Returns:
      the list of type arguments (not null)
    • withAnnotations

      public GenericType.OfClass withAnnotations(Consumer<AnnotatableCreator> builder)
      Description copied from class: GenericType
      Returns this generic type with annotations added by the given builder (not null).
      Overrides:
      withAnnotations in class GenericType.OfThrows
      Parameters:
      builder - the annotation builder (must not be null)
      Returns:
      this generic type with annotations added by the given builder (not null)
    • withAnnotation

      public <A extends Annotation> GenericType.OfClass withAnnotation(Class<A> annotationType)
      Description copied from class: GenericType
      Returns this generic type with the given additional annotation (not null).
      Overrides:
      withAnnotation in class GenericType.OfThrows
      Parameters:
      annotationType - the annotation type (must not be null)
      Returns:
      this generic type with the given additional annotation (not null)
    • withAnnotation

      public <A extends Annotation> GenericType.OfClass withAnnotation(Class<A> annotationType, Consumer<AnnotationCreator<A>> builder)
      Description copied from class: GenericType
      Returns this generic type with the given additional annotation (not null).
      Overrides:
      withAnnotation in class GenericType.OfThrows
      Parameters:
      annotationType - the annotation type (must not be null)
      builder - the builder for the given annotation type (must not be null)
      Returns:
      this generic type with the given additional annotation (not null)
    • isRaw

      public boolean isRaw()
      Description copied from class: GenericType
      Returns true if this type has no type arguments, or false if it has type arguments.
      Specified by:
      isRaw in class GenericType
      Returns:
      true if this type has no type arguments, or false if it has type arguments
    • hasVisibleAnnotations

      public boolean hasVisibleAnnotations()
      Description copied from class: GenericType
      Returns true if this type has runtime-visible type annotations, or false if it does not.
      Overrides:
      hasVisibleAnnotations in class GenericType
      Returns:
      true if this type has runtime-visible type annotations, or false if it does not
    • hasInvisibleAnnotations

      public boolean hasInvisibleAnnotations()
      Description copied from class: GenericType
      Returns true if this type has runtime-invisible type annotations, or false if it does not.
      Overrides:
      hasInvisibleAnnotations in class GenericType
      Returns:
      true if this type has runtime-invisible type annotations, or false if it does not
    • withArguments

      public GenericType.OfClass withArguments(List<TypeArgument> newArguments)
      Returns a copy of this generic type with the given type arguments.
      Parameters:
      newArguments - the new type arguments (must not be null)
      Returns:
      a copy of this generic type with the given type arguments
      Throws:
      IllegalArgumentException - if this type has type arguments and the given number of arguments does not match the current number of arguments
    • equals

      public final boolean equals(GenericType.OfThrows other)
      Description copied from class: GenericType.OfThrows
      Returns true if this object is equal to the given object, or false if it is not.
      Overrides:
      equals in class GenericType.OfThrows
      Returns:
      true if this object is equal to the given object, or false if it is not
    • equals

      public boolean equals(GenericType.OfClass other)
      Returns true if this object is equal to the given object, or false if it is not.
      Returns:
      true if this object is equal to the given object, or false if it is not
    • hashCode

      public int hashCode()
      Description copied from class: GenericType
      Returns the hash code of this generic type.
      Overrides:
      hashCode in class GenericType
      Returns:
      the hash code of this generic type