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>(io.micronaut.core.type.Argument<T> type, @Nullable Qualifier<T> qualifier, List<String> reasons) extends Record implements BeanDefinition<T>, BeanDefinitionReference<T>
Data about a disabled bean. Used to improve error reporting.
  • Constructor Details

    • DisabledBean

      public DisabledBean(io.micronaut.core.type.Argument<T> type, @Nullable Qualifier<T> qualifier, 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, @Nullable 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 @Nullable Qualifier<T> getDeclaredQualifier()
      Description copied from interface: QualifiedBeanType
      Resolve the declared qualifier for this bean.
      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

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

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

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