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 theBeanIntrospection
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 class
AbstractInitializableBeanIntrospection.BeanMethodRef<P>
Bean method compile-time data container.static class
AbstractInitializableBeanIntrospection.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> V
dispatch(int index, B target, java.lang.Object[] args)
Triggers the invocation of the method at index.protected <V> V
dispatchOne(int index, java.lang.Object target, java.lang.Object arg)
Triggers the invocation of the method at index for a single argument call.boolean
equals(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.protected java.lang.reflect.Method
getAccessibleTargetMethodByIndex(int index)
FindMethod
representation at the method by index.io.micronaut.core.annotation.AnnotationMetadata
getAnnotationMetadata()
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.protected abstract java.lang.reflect.Method
getTargetMethodByIndex(int index)
FindMethod
representation at the method by index.int
hashCode()
B
instantiate()
B
instantiate(boolean strictNullable, java.lang.Object... arguments)
protected abstract B
instantiateInternal(java.lang.Object[] arguments)
Reflection free bean instantiation implementation for the given arguments.java.lang.String
toString()
protected java.lang.RuntimeException
unknownDispatchAtIndexException(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
-
getTargetMethodByIndex
@Internal protected abstract java.lang.reflect.Method getTargetMethodByIndex(int index)
FindMethod
representation at the method by index. Used byMethodReference.getTargetMethod()
.- Parameters:
index
- The index- Returns:
- The method
-
getAccessibleTargetMethodByIndex
protected final java.lang.reflect.Method getAccessibleTargetMethodByIndex(int index)
FindMethod
representation at the method by index. Used byMethodReference.getTargetMethod()
.- Parameters:
index
- The index- Returns:
- The method
- Since:
- 3.8.5
-
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 ofgetIndexedProperty(Class, String)
.- 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:
getIndexedProperties
in 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:
instantiate
in 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:
instantiate
in interfaceio.micronaut.core.beans.BeanIntrospection<B>
- Throws:
io.micronaut.core.reflect.exception.InstantiationException
-
getConstructor
public io.micronaut.core.beans.BeanConstructor<B> getConstructor()
- Specified by:
getConstructor
in interfaceio.micronaut.core.beans.BeanIntrospection<B>
-
getConstructorArguments
public io.micronaut.core.type.Argument<?>[] getConstructorArguments()
- Specified by:
getConstructorArguments
in 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:
getIndexedProperty
in 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:
getProperty
in interfaceio.micronaut.core.beans.BeanIntrospection<B>
-
getAnnotationMetadata
public io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
- Specified by:
getAnnotationMetadata
in interfaceio.micronaut.core.annotation.AnnotationMetadataProvider
-
getBeanProperties
@NonNull public java.util.Collection<io.micronaut.core.beans.BeanProperty<B,java.lang.Object>> getBeanProperties()
- Specified by:
getBeanProperties
in interfaceio.micronaut.core.beans.BeanIntrospection<B>
-
getBeanType
@NonNull public java.lang.Class<B> getBeanType()
- Specified by:
getBeanType
in interfaceio.micronaut.core.beans.BeanIntrospection<B>
-
getBeanMethods
@NonNull public java.util.Collection<io.micronaut.core.beans.BeanMethod<B,java.lang.Object>> getBeanMethods()
- Specified by:
getBeanMethods
in interfaceio.micronaut.core.beans.BeanIntrospection<B>
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-