Class AbstractInitializableBeanIntrospection<B>

java.lang.Object
io.micronaut.inject.beans.AbstractInitializableBeanIntrospection<B>
Type Parameters:
B - The bean type
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<B>, io.micronaut.core.beans.BeanIntrospection<B>, io.micronaut.core.beans.UnsafeBeanInstantiationIntrospection<B>, io.micronaut.core.order.Ordered, io.micronaut.core.type.ArgumentCoercible<B>
Direct Known Subclasses:
AbstractInitializableBeanIntrospectionAndReference

public abstract class AbstractInitializableBeanIntrospection<B> extends Object implements io.micronaut.core.beans.UnsafeBeanInstantiationIntrospection<B>
Abstract implementation of the BeanIntrospection interface. This class is subclasses at compilation time by generated byte code and should not be used directly.

Implementation is using method dispatch to access the bean instance.

Since:
3.1
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Bean method compile-time data container.
    static final class 
    Bean property compile-time data container.

    Nested classes/interfaces inherited from interface io.micronaut.core.beans.BeanIntrospection

    io.micronaut.core.beans.BeanIntrospection.Builder<T extends Object>
  • 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
    Modifier
    Constructor
    Description
    protected
    AbstractInitializableBeanIntrospection(Class<B> beanType, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, io.micronaut.core.annotation.AnnotationMetadata constructorAnnotationMetadata, io.micronaut.core.type.Argument<?>[] constructorArguments, AbstractInitializableBeanIntrospection.BeanPropertyRef<Object>[] propertiesRefs, AbstractInitializableBeanIntrospection.BeanMethodRef<Object>[] methodsRefs)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    io.micronaut.core.beans.BeanIntrospection.Builder<B>
     
    protected <V> V
    dispatch(int index, B target, @Nullable Object[] args)
    Triggers the invocation of the method at index.
    protected <V> V
    dispatchOne(int index, @NonNull Object target, @Nullable Object arg)
    Triggers the invocation of the method at index for a single argument call.
    boolean
     
    @Nullable io.micronaut.core.beans.BeanProperty<B,Object>
    findIndexedProperty(@NonNull Class<? extends Annotation> annotationType, @NonNull String annotationValue)
    Get all the bean properties annotated for the given type.
    protected final Method
    Find Method representation at the method by index.
    io.micronaut.core.annotation.AnnotationMetadata
     
    @NonNull Collection<io.micronaut.core.beans.BeanMethod<B,Object>>
     
    @NonNull Collection<io.micronaut.core.beans.BeanProperty<B,Object>>
     
    protected Collection<io.micronaut.core.beans.BeanProperty<B,Object>>
    Returns subset of bean properties defined by an array of indexes.
    List<io.micronaut.core.beans.BeanReadProperty<B,Object>>
     
    @NonNull Class<B>
     
    List<io.micronaut.core.beans.BeanWriteProperty<B,Object>>
     
    io.micronaut.core.beans.BeanConstructor<B>
     
    io.micronaut.core.type.Argument<?>[]
     
    @NonNull Collection<io.micronaut.core.beans.BeanProperty<B,Object>>
    getIndexedProperties(@NonNull Class<? extends Annotation> annotationType)
     
    @NonNull Optional<io.micronaut.core.beans.BeanProperty<B,Object>>
    getIndexedProperty(@NonNull Class<? extends Annotation> annotationType, @NonNull String annotationValue)
     
    @NonNull Optional<io.micronaut.core.beans.BeanProperty<B,Object>>
    getProperty(@NonNull String name)
     
    protected io.micronaut.core.beans.BeanProperty<B,Object>
    getPropertyByIndex(int index)
    Obtain a property by its index.
    protected abstract Method
    Find Method representation at the method by index.
    int
     
     
    instantiate(boolean strictNullable, Object... arguments)
     
    protected B
    instantiateInternal(@Nullable Object[] arguments)
    Reflection free bean instantiation implementation for the given arguments.
    instantiateUnsafe(@NonNull Object... arguments)
     
    int
     
     
    protected final RuntimeException
    Creates a new exception when the dispatch at index is not found.

    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.beans.BeanInfo

    asArgument, getGenericBeanType, getOrder

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

    getIndexedProperty, getProperty, getPropertyNames, getReadProperty, getReadProperty, getReadPropertyNames, getRequiredProperty, getRequiredReadProperty, getRequiredWriteProperty, getWriteProperty, getWriteProperty, hasBuilder, instantiate, isBuildable
  • Constructor Details

  • Method Details

    • builder

      public io.micronaut.core.beans.BeanIntrospection.Builder<B> builder()
      Specified by:
      builder in interface io.micronaut.core.beans.BeanIntrospection<B>
    • instantiateInternal

      @NonNull @Internal protected B instantiateInternal(@Nullable @Nullable Object[] arguments)
      Reflection free bean instantiation implementation for the given arguments.
      Parameters:
      arguments - The arguments
      Returns:
      The bean
    • getPropertyByIndex

      @Internal protected io.micronaut.core.beans.BeanProperty<B,Object> getPropertyByIndex(int index)
      Obtain a property by its index.
      Parameters:
      index - The index of the property
      Returns:
      A bean property
    • propertyIndexOf

      public int propertyIndexOf(String name)
      Specified by:
      propertyIndexOf in interface io.micronaut.core.beans.BeanIntrospection<B>
    • getTargetMethodByIndex

      @Internal protected abstract Method getTargetMethodByIndex(int index)
      Find Method representation at the method by index. Used by MethodReference.getTargetMethod().
      Parameters:
      index - The index
      Returns:
      The method
    • getAccessibleTargetMethodByIndex

      protected final Method getAccessibleTargetMethodByIndex(int index)
      Find Method representation at the method by index. Used by MethodReference.getTargetMethod().
      Parameters:
      index - The index
      Returns:
      The method
      Since:
      3.8.5
    • dispatch

      @Nullable protected <V> V dispatch(int index, @NonNull B target, @Nullable @Nullable Object[] args)
      Triggers the invocation of the method at index.
      Type Parameters:
      V - The result type
      Parameters:
      index - The method index
      target - The target
      args - The arguments
      Returns:
      The result
    • dispatchOne

      @Nullable protected <V> V dispatchOne(int index, @NonNull @NonNull Object target, @Nullable @Nullable Object arg)
      Triggers the invocation of the method at index for a single argument call. Allowing to not wrap a single argument in an object array.
      Type Parameters:
      V - The result type
      Parameters:
      index - The method index
      target - The target
      arg - The argument
      Returns:
      The result
    • unknownDispatchAtIndexException

      protected final RuntimeException unknownDispatchAtIndexException(int index)
      Creates a new exception when the dispatch at index is not found.
      Parameters:
      index - The method index
      Returns:
      The exception
    • findIndexedProperty

      @Nullable public @Nullable io.micronaut.core.beans.BeanProperty<B,Object> findIndexedProperty(@NonNull @NonNull Class<? extends Annotation> annotationType, @NonNull @NonNull String annotationValue)
      Get all the bean properties annotated for the given type. Nullable result method version of getIndexedProperty(Class, String).
      Parameters:
      annotationType - The annotation type
      annotationValue - The annotation value
      Returns:
      An immutable collection of properties.
      See Also:
      • Introspected.indexed()
    • getIndexedProperties

      @NonNull public @NonNull Collection<io.micronaut.core.beans.BeanProperty<B,Object>> getIndexedProperties(@NonNull @NonNull Class<? extends Annotation> annotationType)
      Specified by:
      getIndexedProperties in interface io.micronaut.core.beans.BeanIntrospection<B>
    • getBeanPropertiesIndexedSubset

      protected Collection<io.micronaut.core.beans.BeanProperty<B,Object>> getBeanPropertiesIndexedSubset(int[] indexes)
      Returns subset of bean properties defined by an array of indexes.
      Parameters:
      indexes - The indexes
      Returns:
      a collection of bean properties
    • instantiate

      public B instantiate() throws io.micronaut.core.reflect.exception.InstantiationException
      Specified by:
      instantiate in interface io.micronaut.core.beans.BeanIntrospection<B>
      Throws:
      io.micronaut.core.reflect.exception.InstantiationException
    • instantiate

      @NonNull public B instantiate(boolean strictNullable, Object... arguments) throws io.micronaut.core.reflect.exception.InstantiationException
      Specified by:
      instantiate in interface io.micronaut.core.beans.BeanIntrospection<B>
      Throws:
      io.micronaut.core.reflect.exception.InstantiationException
    • instantiateUnsafe

      public B instantiateUnsafe(@NonNull @NonNull Object... arguments)
      Specified by:
      instantiateUnsafe in interface io.micronaut.core.beans.UnsafeBeanInstantiationIntrospection<B>
    • getConstructor

      public io.micronaut.core.beans.BeanConstructor<B> getConstructor()
      Specified by:
      getConstructor in interface io.micronaut.core.beans.BeanIntrospection<B>
    • getConstructorArguments

      public io.micronaut.core.type.Argument<?>[] getConstructorArguments()
      Specified by:
      getConstructorArguments in interface io.micronaut.core.beans.BeanIntrospection<B>
    • getIndexedProperty

      @NonNull public @NonNull Optional<io.micronaut.core.beans.BeanProperty<B,Object>> getIndexedProperty(@NonNull @NonNull Class<? extends Annotation> annotationType, @NonNull @NonNull String annotationValue)
      Specified by:
      getIndexedProperty in interface io.micronaut.core.beans.BeanIntrospection<B>
    • getProperty

      @NonNull public @NonNull Optional<io.micronaut.core.beans.BeanProperty<B,Object>> getProperty(@NonNull @NonNull String name)
      Specified by:
      getProperty in interface io.micronaut.core.beans.BeanIntrospection<B>
    • getAnnotationMetadata

      public io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
      Specified by:
      getAnnotationMetadata in interface io.micronaut.core.annotation.AnnotationMetadataProvider
    • getBeanProperties

      @NonNull public @NonNull Collection<io.micronaut.core.beans.BeanProperty<B,Object>> getBeanProperties()
      Specified by:
      getBeanProperties in interface io.micronaut.core.beans.BeanIntrospection<B>
    • getBeanReadProperties

      public List<io.micronaut.core.beans.BeanReadProperty<B,Object>> getBeanReadProperties()
      Specified by:
      getBeanReadProperties in interface io.micronaut.core.beans.BeanIntrospection<B>
    • getBeanWriteProperties

      public List<io.micronaut.core.beans.BeanWriteProperty<B,Object>> getBeanWriteProperties()
      Specified by:
      getBeanWriteProperties in interface io.micronaut.core.beans.BeanIntrospection<B>
    • getBeanType

      @NonNull public @NonNull Class<B> getBeanType()
      Specified by:
      getBeanType in interface io.micronaut.core.beans.BeanInfo<B>
      Specified by:
      getBeanType in interface io.micronaut.core.beans.BeanIntrospection<B>
    • getBeanMethods

      @NonNull public @NonNull Collection<io.micronaut.core.beans.BeanMethod<B,Object>> getBeanMethods()
      Specified by:
      getBeanMethods in interface io.micronaut.core.beans.BeanIntrospection<B>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object