Record Class MethodHierarchy.Declaration

java.lang.Object
java.lang.Record
io.micronaut.reflection.MethodHierarchy.Declaration
Record Components:
declaringType - The type declaring it
annotationMetadata - The annotations of the method, without the ones of its declaring type
arguments - The parameters
returnArgument - The return value
exact - Whether the annotations are the ones of this declaration only: a generated introspection merges the annotations of the overridden methods into them
Enclosing class:
MethodHierarchy

public static record MethodHierarchy.Declaration(Class<?> declaringType, AnnotationMetadata annotationMetadata, Argument<?>[] arguments, Argument<?> returnArgument, boolean exact) extends Record
One declaration of a method by one type of a hierarchy.
Since:
5.2.0
Author:
Denis Stepanov
  • Constructor Details

    • Declaration

      public Declaration(Class<?> declaringType, AnnotationMetadata annotationMetadata, Argument<?>[] arguments, Argument<?> returnArgument, boolean exact)
      Creates an instance of a Declaration record class.
      Parameters:
      declaringType - the value for the declaringType record component
      annotationMetadata - the value for the annotationMetadata record component
      arguments - the value for the arguments record component
      returnArgument - the value for the returnArgument record component
      exact - the value for the exact record component
  • Method Details

    • of

      public static MethodHierarchy.Declaration of(ExecutableMethod<?,?> method)
      The declaration an executable method reports. The metadata of an executable method merges the annotations of the methods it overrides, so the declaration is not exact().
      Parameters:
      method - The method
      Returns:
      The declaration
    • of

      public static MethodHierarchy.Declaration of(BeanMethod<?,?> method, boolean exact)
      The declaration a bean method reports.
      Parameters:
      method - The method
      exact - Whether the introspection reporting it tells the annotations of this declaration apart from the ones of the methods it overrides
      Returns:
      The declaration
    • of

      public static MethodHierarchy.Declaration of(Method method)
      The declaration read from a Method itself. Java reflection does not inherit the annotations of a method, so the declaration is exact().
      Parameters:
      method - The method
      Returns:
      The declaration
    • of

      public static MethodHierarchy.Declaration of(Method method, Class<?> context)
      The declaration a type reads under a method, with the arguments and the return that type sees: a method a generic super type declares is read with the values the reading type gives the variables, as the processors generate them for it, rather than with the bounds of the variables. The type declaring the method is still the type of the declaration, which is what the hierarchy is walked from.
      Parameters:
      method - The method
      context - The type reading the method, an implementation of its declaring type
      Returns:
      The declaration
    • declaredOf

      public static AnnotationMetadata declaredOf(AnnotationMetadata annotationMetadata)
      The annotations declared on an executable, without the ones of its class: the executable methods of beans carry both. A metadata that is not a hierarchy is returned as is, getDeclaredMetadata() would drop the repeated annotations.
      Parameters:
      annotationMetadata - The metadata
      Returns:
      The metadata of the executable alone
    • equals

      public boolean equals(Object obj)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      obj - the object with which to compare
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • declaringType

      public Class<?> declaringType()
      Returns the value of the declaringType record component.
      Returns:
      the value of the declaringType record component
    • annotationMetadata

      public AnnotationMetadata annotationMetadata()
      Returns the value of the annotationMetadata record component.
      Returns:
      the value of the annotationMetadata record component
    • arguments

      public Argument<?>[] arguments()
      Returns the value of the arguments record component.
      Returns:
      the value of the arguments record component
    • returnArgument

      public Argument<?> returnArgument()
      Returns the value of the returnArgument record component.
      Returns:
      the value of the returnArgument record component
    • exact

      public boolean exact()
      Returns the value of the exact record component.
      Returns:
      the value of the exact record component