Package io.micronaut.inject.beans
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.BeanIntrospection<B>
public abstract class AbstractInitializableBeanIntrospection<B> extends java.lang.Object implements io.micronaut.core.beans.BeanIntrospection<B>Abstract implementation of theBeanIntrospectioninterface. 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 classAbstractInitializableBeanIntrospection.BeanMethodRef<P>Bean method compile-time data container.static classAbstractInitializableBeanIntrospection.BeanPropertyRef<P>Bean property compile-time data container.
-
Constructor Summary
Constructors Constructor Description AbstractInitializableBeanIntrospection(java.lang.Class<B> beanType, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, io.micronaut.core.annotation.AnnotationMetadata constructorAnnotationMetadata, io.micronaut.core.type.Argument<?>[] constructorArguments, AbstractInitializableBeanIntrospection.BeanPropertyRef<java.lang.Object>[] propertiesRefs, AbstractInitializableBeanIntrospection.BeanMethodRef<java.lang.Object>[] methodsRefs)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected <V> Vdispatch(int index, B target, java.lang.Object[] args)Triggers the invocation of the method at index.protected <V> VdispatchOne(int index, java.lang.Object target, java.lang.Object arg)Triggers the invocation of the method at index for a single argument call.booleanequals(java.lang.Object o)io.micronaut.core.beans.BeanProperty<B,java.lang.Object>findIndexedProperty(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.lang.String annotationValue)Get all the bean properties annotated for the given type.io.micronaut.core.annotation.AnnotationMetadatagetAnnotationMetadata()java.util.Collection<io.micronaut.core.beans.BeanMethod<B,java.lang.Object>>getBeanMethods()java.util.Collection<io.micronaut.core.beans.BeanProperty<B,java.lang.Object>>getBeanProperties()protected java.util.Collection<io.micronaut.core.beans.BeanProperty<B,java.lang.Object>>getBeanPropertiesIndexedSubset(int[] indexes)Returns subset of bean properties defined by an array of indexes.java.lang.Class<B>getBeanType()io.micronaut.core.beans.BeanConstructor<B>getConstructor()io.micronaut.core.type.Argument<?>[]getConstructorArguments()java.util.Collection<io.micronaut.core.beans.BeanProperty<B,java.lang.Object>>getIndexedProperties(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)java.util.Optional<io.micronaut.core.beans.BeanProperty<B,java.lang.Object>>getIndexedProperty(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.lang.String annotationValue)java.util.Optional<io.micronaut.core.beans.BeanProperty<B,java.lang.Object>>getProperty(java.lang.String name)protected io.micronaut.core.beans.BeanProperty<B,java.lang.Object>getPropertyByIndex(int index)Obtain a property by its index.inthashCode()Binstantiate()Binstantiate(boolean strictNullable, java.lang.Object... arguments)protected abstract BinstantiateInternal(java.lang.Object[] arguments)Reflection free bean instantiation implementation for the given arguments.java.lang.StringtoString()protected java.lang.RuntimeExceptionunknownDispatchAtIndexException(int index)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
getAnnotationValuesByName, getAnnotationValuesByStereotype, getDeclaredAnnotationValuesByName, getValues, hasDeclaredStereotype, isAnnotationPresent, isDeclaredAnnotationPresent
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, 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, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, 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
-
-
-
-
Constructor Detail
-
AbstractInitializableBeanIntrospection
public AbstractInitializableBeanIntrospection(java.lang.Class<B> beanType, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, io.micronaut.core.annotation.AnnotationMetadata constructorAnnotationMetadata, io.micronaut.core.type.Argument<?>[] constructorArguments, AbstractInitializableBeanIntrospection.BeanPropertyRef<java.lang.Object>[] propertiesRefs, AbstractInitializableBeanIntrospection.BeanMethodRef<java.lang.Object>[] methodsRefs)
-
-
Method Detail
-
instantiateInternal
@NonNull @Internal protected abstract B instantiateInternal(@Nullable java.lang.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,java.lang.Object> getPropertyByIndex(int index)
Obtain a property by its index.- Parameters:
index- The index of the property- Returns:
- A bean property
-
dispatch
@Nullable protected <V> V dispatch(int index, @NonNull B target, @Nullable java.lang.Object[] args)Triggers the invocation of the method at index.- Type Parameters:
V- The result type- Parameters:
index- The method indextarget- The targetargs- The arguments- Returns:
- The result
-
dispatchOne
@Nullable protected <V> V dispatchOne(int index, @NonNull java.lang.Object target, @Nullable java.lang.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 indextarget- The targetarg- The argument- Returns:
- The result
-
unknownDispatchAtIndexException
protected final java.lang.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 io.micronaut.core.beans.BeanProperty<B,java.lang.Object> findIndexedProperty(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, @NonNull java.lang.String annotationValue)
Get all the bean properties annotated for the given type. Nullable result method version of {@see getIndexedProperty}.- Parameters:
annotationType- The annotation typeannotationValue- The annotation value- Returns:
- A immutable collection of properties.
- See Also:
Introspected.indexed()
-
getIndexedProperties
@NonNull public java.util.Collection<io.micronaut.core.beans.BeanProperty<B,java.lang.Object>> getIndexedProperties(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
- Specified by:
getIndexedPropertiesin interfaceio.micronaut.core.beans.BeanIntrospection<B>
-
getBeanPropertiesIndexedSubset
protected java.util.Collection<io.micronaut.core.beans.BeanProperty<B,java.lang.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:
instantiatein interfaceio.micronaut.core.beans.BeanIntrospection<B>- Throws:
io.micronaut.core.reflect.exception.InstantiationException
-
instantiate
@NonNull public B instantiate(boolean strictNullable, java.lang.Object... arguments) throws io.micronaut.core.reflect.exception.InstantiationException
- Specified by:
instantiatein interfaceio.micronaut.core.beans.BeanIntrospection<B>- Throws:
io.micronaut.core.reflect.exception.InstantiationException
-
getConstructor
public io.micronaut.core.beans.BeanConstructor<B> getConstructor()
- Specified by:
getConstructorin interfaceio.micronaut.core.beans.BeanIntrospection<B>
-
getConstructorArguments
public io.micronaut.core.type.Argument<?>[] getConstructorArguments()
- Specified by:
getConstructorArgumentsin interfaceio.micronaut.core.beans.BeanIntrospection<B>
-
getIndexedProperty
@NonNull public java.util.Optional<io.micronaut.core.beans.BeanProperty<B,java.lang.Object>> getIndexedProperty(@NonNull java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, @NonNull java.lang.String annotationValue)
- Specified by:
getIndexedPropertyin interfaceio.micronaut.core.beans.BeanIntrospection<B>
-
getProperty
@NonNull public java.util.Optional<io.micronaut.core.beans.BeanProperty<B,java.lang.Object>> getProperty(@NonNull java.lang.String name)
- Specified by:
getPropertyin interfaceio.micronaut.core.beans.BeanIntrospection<B>
-
getAnnotationMetadata
public io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
- Specified by:
getAnnotationMetadatain interfaceio.micronaut.core.annotation.AnnotationMetadataProvider
-
getBeanProperties
@NonNull public java.util.Collection<io.micronaut.core.beans.BeanProperty<B,java.lang.Object>> getBeanProperties()
- Specified by:
getBeanPropertiesin interfaceio.micronaut.core.beans.BeanIntrospection<B>
-
getBeanType
@NonNull public java.lang.Class<B> getBeanType()
- Specified by:
getBeanTypein interfaceio.micronaut.core.beans.BeanIntrospection<B>
-
getBeanMethods
@NonNull public java.util.Collection<io.micronaut.core.beans.BeanMethod<B,java.lang.Object>> getBeanMethods()
- Specified by:
getBeanMethodsin interfaceio.micronaut.core.beans.BeanIntrospection<B>
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-