B
- The bean typepublic abstract class AbstractInitializableBeanIntrospection<B> extends Object implements BeanIntrospection<B>
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.
Modifier and Type | Class and Description |
---|---|
static class |
AbstractInitializableBeanIntrospection.BeanMethodRef<P>
Bean method compile-time data container.
|
static class |
AbstractInitializableBeanIntrospection.BeanPropertyRef<P>
Bean property compile-time data container.
|
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
EMPTY
Constructor and Description |
---|
AbstractInitializableBeanIntrospection(Class<B> beanType,
AnnotationMetadata annotationMetadata,
AnnotationMetadata constructorAnnotationMetadata,
Argument<?>[] constructorArguments,
AbstractInitializableBeanIntrospection.BeanPropertyRef<Object>[] propertiesRefs,
AbstractInitializableBeanIntrospection.BeanMethodRef<Object>[] methodsRefs) |
Modifier and Type | Method and Description |
---|---|
protected <V> V |
dispatch(int index,
B target,
Object[] args)
Triggers the invocation of the method at index.
|
protected <V> V |
dispatchOne(int index,
Object target,
Object arg)
Triggers the invocation of the method at index for a single argument call.
|
boolean |
equals(Object o) |
BeanProperty<B,Object> |
findIndexedProperty(Class<? extends Annotation> annotationType,
String annotationValue)
Get all the bean properties annotated for the given type.
|
AnnotationMetadata |
getAnnotationMetadata()
Supplies the metadata.
|
Collection<BeanMethod<B,Object>> |
getBeanMethods()
Returns the
BeanMethod instances for this introspection. |
Collection<BeanProperty<B,Object>> |
getBeanProperties() |
protected Collection<BeanProperty<B,Object>> |
getBeanPropertiesIndexedSubset(int[] indexes)
Returns subset of bean properties defined by an array of indexes.
|
Class<B> |
getBeanType()
The bean type.
|
BeanConstructor<B> |
getConstructor() |
Argument<?>[] |
getConstructorArguments()
The constructor arguments needed to instantiate the bean.
|
Collection<BeanProperty<B,Object>> |
getIndexedProperties(Class<? extends Annotation> annotationType)
Get all the bean properties annotated for the given annotation type.
|
Optional<BeanProperty<B,Object>> |
getIndexedProperty(Class<? extends Annotation> annotationType,
String annotationValue)
Get all the bean properties annotated for the given type.
|
Optional<BeanProperty<B,Object>> |
getProperty(String name)
Obtain a property by name.
|
protected BeanProperty<B,Object> |
getPropertyByIndex(int index)
Obtain a property by its index.
|
int |
hashCode() |
B |
instantiate()
Instantiates an instance of the bean, throwing an exception is instantiation is not possible.
|
B |
instantiate(boolean strictNullable,
Object... arguments)
Instantiates an instance of the bean, throwing an exception is instantiation is not possible.
|
protected abstract B |
instantiateInternal(Object[] arguments)
Reflection free bean instantiation implementation for the given arguments.
|
String |
toString() |
protected RuntimeException |
unknownDispatchAtIndexException(int index)
Creates a new exception when the dispatch at index is not found.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getIndexedProperty, getIntrospection, getProperty, getPropertyNames, getRequiredProperty, instantiate, propertyIndexOf
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, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, 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
getAnnotationValuesByName, getDeclaredAnnotationValuesByName, getValues, hasDeclaredStereotype, isAnnotationPresent, isDeclaredAnnotationPresent
public AbstractInitializableBeanIntrospection(Class<B> beanType, AnnotationMetadata annotationMetadata, AnnotationMetadata constructorAnnotationMetadata, Argument<?>[] constructorArguments, AbstractInitializableBeanIntrospection.BeanPropertyRef<Object>[] propertiesRefs, AbstractInitializableBeanIntrospection.BeanMethodRef<Object>[] methodsRefs)
@NonNull @Internal protected abstract B instantiateInternal(@Nullable Object[] arguments)
arguments
- The arguments@Internal protected BeanProperty<B,Object> getPropertyByIndex(int index)
index
- The index of the property@Nullable protected <V> V dispatch(int index, @NonNull B target, @Nullable Object[] args)
V
- The result typeindex
- The method indextarget
- The targetargs
- The arguments@Nullable protected <V> V dispatchOne(int index, @NonNull Object target, @Nullable Object arg)
V
- The result typeindex
- The method indextarget
- The targetarg
- The argumentprotected final RuntimeException unknownDispatchAtIndexException(int index)
index
- The method index@Nullable public BeanProperty<B,Object> findIndexedProperty(@NonNull Class<? extends Annotation> annotationType, @NonNull String annotationValue)
getIndexedProperty
.annotationType
- The annotation typeannotationValue
- The annotation valueIntrospected.indexed()
@NonNull public Collection<BeanProperty<B,Object>> getIndexedProperties(@NonNull Class<? extends Annotation> annotationType)
BeanIntrospection
Introspected.indexed()
by the given annotation,
then it will be included in the resulting list.getIndexedProperties
in interface BeanIntrospection<B>
annotationType
- The annotation typeIntrospected.indexed()
protected Collection<BeanProperty<B,Object>> getBeanPropertiesIndexedSubset(int[] indexes)
indexes
- The indexespublic B instantiate() throws InstantiationException
BeanIntrospection
instantiate
in interface BeanIntrospection<B>
InstantiationException
- If the bean cannot be instantiated or the arguments are not satisfied.@NonNull public B instantiate(boolean strictNullable, Object... arguments) throws InstantiationException
BeanIntrospection
instantiate
in interface BeanIntrospection<B>
strictNullable
- If true, require null parameters to be annotated with a nullable annotationarguments
- The arguments required to instantiate bean. Should match the types returned by BeanIntrospection.getConstructorArguments()
InstantiationException
- If the bean cannot be instantiated.public BeanConstructor<B> getConstructor()
getConstructor
in interface BeanIntrospection<B>
public Argument<?>[] getConstructorArguments()
BeanIntrospection
getConstructorArguments
in interface BeanIntrospection<B>
@NonNull public Optional<BeanProperty<B,Object>> getIndexedProperty(@NonNull Class<? extends Annotation> annotationType, @NonNull String annotationValue)
BeanIntrospection
getIndexedProperty
in interface BeanIntrospection<B>
annotationType
- The annotation typeannotationValue
- The annotation valueIntrospected.indexed()
@NonNull public Optional<BeanProperty<B,Object>> getProperty(@NonNull String name)
BeanIntrospection
getProperty
in interface BeanIntrospection<B>
name
- The name of the propertypublic AnnotationMetadata getAnnotationMetadata()
AnnotationMetadataProvider
AnnotationMetadata.EMPTY_METADATA
.getAnnotationMetadata
in interface AnnotationMetadataProvider
AnnotationMetadata
@NonNull public Collection<BeanProperty<B,Object>> getBeanProperties()
getBeanProperties
in interface BeanIntrospection<B>
@NonNull public Class<B> getBeanType()
BeanIntrospection
getBeanType
in interface BeanIntrospection<B>
@NonNull public Collection<BeanMethod<B,Object>> getBeanMethods()
BeanIntrospection
BeanMethod
instances for this introspection.
The BeanMethod
instances are only those methods annotated with io.micronaut.context.annotation.Executable
and hence represent a subset
of the actual methods of the class and do not include any methods that are exposed as BeanProperty
instances.
getBeanMethods
in interface BeanIntrospection<B>