Record Class DisabledBean<T>

java.lang.Object
java.lang.Record
io.micronaut.context.DisabledBean<T>
Type Parameters:
T - The bean type
Record Components:
type - The bean type
qualifier - The qualifier
reasons - The reasons the bean is disabled
All Implemented Interfaces:
io.micronaut.core.annotation.AnnotationMetadata, io.micronaut.core.annotation.AnnotationMetadataDelegate, io.micronaut.core.annotation.AnnotationMetadataProvider, io.micronaut.core.annotation.AnnotationSource, io.micronaut.core.beans.BeanInfo<T>, io.micronaut.core.naming.Named, io.micronaut.core.order.Ordered, io.micronaut.core.type.ArgumentCoercible<T>, BeanContextConditional, BeanDefinition<T>, BeanDefinitionReference<T>, BeanType<T>, QualifiedBeanType<T>

public record DisabledBean<T>(@NonNull io.micronaut.core.type.Argument<T> type, @Nullable Qualifier<T> qualifier, @NonNull List<String> reasons) extends Record implements BeanDefinition<T>, BeanDefinitionReference<T>
Data about a disabled bean. Used to improve error reporting.
  • Field Summary

    Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata

    CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER

    Fields inherited from interface io.micronaut.core.annotation.AnnotationSource

    EMPTY

    Fields inherited from interface io.micronaut.core.order.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    DisabledBean(@NonNull io.micronaut.core.type.Argument<T> type, @Nullable Qualifier<T> qualifier, @NonNull List<String> reasons)
    Creates an instance of a DisabledBean record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    io.micronaut.core.type.Argument<T>
     
    final boolean
    Indicates whether some other object is "equal to" this one.
     
    Returns the bean type.
    Resolve the declared qualifier for this bean.
    io.micronaut.core.type.Argument<T>
     
    int
    Returns a hash code value for this object.
    boolean
     
    boolean
    isEnabled(BeanContext context, BeanResolutionContext resolutionContext)
    Return whether this component is enabled for the given context.
    boolean
     
    boolean
     
    Loads the bean definition.
    @Nullable Qualifier<T>
    Returns the value of the qualifier record component.
    @NonNull List<String>
    Returns the value of the reasons record component.
    final String
    Returns a string representation of this record class.
    @NonNull io.micronaut.core.type.Argument<T>
    Returns the value of the type record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadata

    enumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, hasEvaluatedExpressions, hasStereotypeNonRepeating, isAnnotationPresent, isDeclaredAnnotationPresent

    Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate

    booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, copyAnnotationMetadata, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, findRepeatableAnnotation, findRepeatableAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByName, getAnnotationValuesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByName, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getTargetAnnotationMetadata, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasPropertyExpressions, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isRepeatableAnnotation, isRepeatableAnnotation, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesize, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType

    Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider

    getAnnotationMetadata

    Methods inherited from interface io.micronaut.inject.BeanContextConditional

    isEnabled

    Methods inherited from interface io.micronaut.inject.BeanDefinitionReference

    isContextScope, isProxiedBean, isProxyTarget, load

    Methods inherited from interface io.micronaut.core.beans.BeanInfo

    getOrder

    Methods inherited from interface io.micronaut.inject.BeanType

    getBeanName, getExposedTypes, isContainerType, isPrimary, requiresMethodProcessing
  • Constructor Details

    • DisabledBean

      public DisabledBean(@NonNull @NonNull io.micronaut.core.type.Argument<T> type, @Nullable @Nullable Qualifier<T> qualifier, @NonNull @NonNull List<String> reasons)
      Creates an instance of a DisabledBean record class.
      Parameters:
      type - the value for the type record component
      qualifier - the value for the qualifier record component
      reasons - the value for the reasons record component
  • Method Details

    • isEnabled

      public boolean isEnabled(BeanContext context, BeanResolutionContext resolutionContext)
      Description copied from interface: BeanContextConditional
      Return whether this component is enabled for the given context.
      Specified by:
      isEnabled in interface BeanContextConditional
      Parameters:
      context - The context
      resolutionContext - The bean resolution context
      Returns:
      True if it is
    • isConfigurationProperties

      public boolean isConfigurationProperties()
      Specified by:
      isConfigurationProperties in interface BeanDefinition<T>
      Specified by:
      isConfigurationProperties in interface BeanDefinitionReference<T>
      Returns:
      Is the type configuration properties.
    • isSingleton

      public boolean isSingleton()
      Specified by:
      isSingleton in interface BeanDefinition<T>
      Specified by:
      isSingleton in interface BeanDefinitionReference<T>
      Returns:
      Whether the scope is singleton
    • getDeclaredQualifier

      public Qualifier<T> getDeclaredQualifier()
      Description copied from interface: BeanDefinition
      Resolve the declared qualifier for this bean.
      Specified by:
      getDeclaredQualifier in interface BeanDefinition<T>
      Specified by:
      getDeclaredQualifier in interface QualifiedBeanType<T>
      Returns:
      The qualifier or null if this isn't one
    • getBeanType

      public Class<T> getBeanType()
      Description copied from interface: BeanType
      Returns the bean type.
      Specified by:
      getBeanType in interface BeanDefinition<T>
      Specified by:
      getBeanType in interface io.micronaut.core.beans.BeanInfo<T>
      Specified by:
      getBeanType in interface BeanType<T>
      Returns:
      The produced bean type
    • asArgument

      public io.micronaut.core.type.Argument<T> asArgument()
      Specified by:
      asArgument in interface io.micronaut.core.type.ArgumentCoercible<T>
      Specified by:
      asArgument in interface BeanDefinition<T>
      Specified by:
      asArgument in interface io.micronaut.core.beans.BeanInfo<T>
    • getGenericBeanType

      public io.micronaut.core.type.Argument<T> getGenericBeanType()
      Specified by:
      getGenericBeanType in interface BeanDefinition<T>
      Specified by:
      getGenericBeanType in interface io.micronaut.core.beans.BeanInfo<T>
    • getBeanDefinitionName

      public String getBeanDefinitionName()
      Specified by:
      getBeanDefinitionName in interface BeanDefinitionReference<T>
      Returns:
      The class name of the backing BeanDefinition
    • load

      public BeanDefinition<T> load()
      Description copied from interface: BeanDefinitionReference
      Loads the bean definition.
      Specified by:
      load in interface BeanDefinitionReference<T>
      Returns:
      The loaded component definition or null if it shouldn't be loaded
    • isPresent

      public boolean isPresent()
      Specified by:
      isPresent in interface BeanDefinitionReference<T>
      Returns:
      Is the underlying bean type present on the classpath
    • 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 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
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • type

      @NonNull public @NonNull io.micronaut.core.type.Argument<T> type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • qualifier

      @Nullable public @Nullable Qualifier<T> qualifier()
      Returns the value of the qualifier record component.
      Returns:
      the value of the qualifier record component
    • reasons

      @NonNull public @NonNull List<String> reasons()
      Returns the value of the reasons record component.
      Returns:
      the value of the reasons record component