Record Class Parameter

java.lang.Object
java.lang.Record
be.imgn.inject.context.Parameter
Record Components:
name - the parameter name (for inspection)
type - the parameter type (its inner type when isProvider)
qualifierType - the marker qualifier annotation type, or null
qualifier - the qualifier annotation instance, or null
annotationMetadata - annotations present on the parameter
isProvider - whether the declared parameter is a Provider of type

public record Parameter(String name, Type type, @Nullable Class<? extends Annotation> qualifierType, @Nullable Annotation qualifier, AnnotationMetadata annotationMetadata, boolean isProvider) extends Record
Describes one constructor or method parameter to inject. A qualifier is either a marker annotation type (qualifierType) or a concrete annotation instance (qualifier); at most one is non-null.
  • Constructor Details

    • Parameter

      public Parameter(String name, Type type, @Nullable Class<? extends Annotation> qualifierType, @Nullable Annotation qualifier, AnnotationMetadata annotationMetadata, boolean isProvider)
      Creates a parameter description.
      Parameters:
      name - the parameter name
      type - the parameter type
      qualifierType - the marker qualifier annotation type, or null
      qualifier - the qualifier annotation instance, or null
      annotationMetadata - annotations present on the parameter
      isProvider - provider flag
    • Parameter

      public Parameter(String name, Type type)
      Creates a parameter description.
      Parameters:
      name - the parameter name
      type - the parameter type
    • Parameter

      public Parameter(String name, Type type, boolean isProvider)
      Creates a parameter description.
      Parameters:
      name - the parameter name
      type - the parameter type
      isProvider - provider flag
    • Parameter

      public Parameter(String name, Type type, Class<? extends Annotation> qualifierType)
      Creates a parameter description.
      Parameters:
      name - the parameter name
      type - the parameter type
      qualifierType - the marker qualifier annotation type
    • Parameter

      public Parameter(String name, Type type, Class<? extends Annotation> qualifierType, boolean isProvider)
      Creates a parameter description.
      Parameters:
      name - the parameter name
      type - the parameter type
      qualifierType - the marker qualifier annotation type
      isProvider - provider flag
    • Parameter

      public Parameter(String name, Type type, Annotation qualifier)
      Creates a parameter description.
      Parameters:
      name - the parameter name
      type - the parameter type
      qualifier - the qualifier annotation instance
    • Parameter

      public Parameter(String name, Type type, Annotation qualifier, boolean isProvider)
      Creates a parameter description.
      Parameters:
      name - the parameter name
      type - the parameter type
      qualifier - the qualifier annotation instance
      isProvider - provider flag
  • Method Details

    • hasQualifier

      public boolean hasQualifier()
      Returns whether this parameter has a qualifier.
      Returns:
      whether this parameter has a qualifier
    • key

      public <T> Key<T> key()
      Returns the key for this parameter.
      Type Parameters:
      T - the dependency type
      Returns:
      the key for this parameter
    • toString

      public final 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
    • hashCode

      public final 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
    • equals

      public final boolean equals(Object o)
      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:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • type

      public Type type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • qualifierType

      public @Nullable Class<? extends Annotation> qualifierType()
      Returns the value of the qualifierType record component.
      Returns:
      the value of the qualifierType record component
    • qualifier

      public @Nullable Annotation qualifier()
      Returns the value of the qualifier record component.
      Returns:
      the value of the qualifier record component
    • annotationMetadata

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

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