Class SupplementedBeanIntrospection<T>
- Type Parameters:
T- The bean type
- All Implemented Interfaces:
AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, BeanInfo<T>, BeanIntrospection<T>, Ordered, ArgumentCoercible<T>, ReflectiveIntrospection<T>
BeanIntrospection completed by a reflective one: the properties, the constructor and
the methods the processor generated are served as generated, and the executables it left out — the
methods that are not @Executable, the other constructors — come from reflection.
A processor generates what the application needs; a specification describing the type needs all of it. This keeps one introspection per type, generated where it exists.
- Since:
- 5.2.0
- Author:
- Denis Stepanov
-
Nested Class Summary
Nested classes/interfaces inherited from interface BeanIntrospection
BeanIntrospection.Builder<T>Nested classes/interfaces inherited from interface ReflectiveIntrospection
ReflectiveIntrospection.ReflectivePropertyMember<B> -
Field Summary
Fields inherited from interface AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBERFields inherited from interface AnnotationSource
EMPTYFields inherited from interface Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionSupplementedBeanIntrospection(BeanIntrospection<T> generated, ReflectionBeanIntrospection<T> reflected) Creates an introspection completing a generated one with a reflective one. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()findDeclaredMethod(String name, Class<?>... parameterTypes) Finds the method the introspected type itself declares, with the annotations of that declaration only: the generated metadata of a method merges the annotations of the methods it overrides.Supplies the metadata.Returns theBeanMethodinstances for this introspection.The generated properties, each with the type arguments the reflection reads from every member: the getter of an interface can declareMap<String, @NotBlank String>where the field is a plainMap<String, String>.The read properties the generated introspection reports, each as it reports it, completed by the ones of a property it does not describe at all.The bean type.The write properties the generated introspection reports, each as it reports it, completed by the ones of a property it does not describe at all, the waygetBeanReadProperties()completes the read ones.The generated constructor, with the metadata the reflection reads from the constructor when the generated one carries none: a generated introspection instantiates, it does not describe.Argument<?>[]The constructor arguments needed to instantiate the bean.Returns the constructors this introspection describes.The generated introspection this one completes.getIndexedProperties(Class<? extends Annotation> annotationType) Get all the bean properties annotated for the given annotation type.getIndexedProperty(Class<? extends Annotation> annotationType, String annotationValue) Get all the bean properties annotated for the given type.getProperty(String name) Obtain a property by name.booleanDoes the introspection have a backing builder.Instantiates an instance of the bean, throwing an exception is instantiation is not possible.instantiate(boolean strictNullable, @Nullable Object... arguments) Instantiates an instance of the bean, throwing an exception is instantiation is not possible.booleanCan the introspection be constructed withBeanIntrospection.builder().toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface AnnotationMetadata
enumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, hasStereotypeNonRepeating, isAnnotationPresent, isDeclaredAnnotationPresentMethods inherited from interface 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, hasEvaluatedExpressions, 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, synthesizeDeclaredAnnotationsByTypeMethods inherited from interface BeanInfo
asArgument, getGenericBeanType, getOrderMethods inherited from interface BeanIntrospection
getIndexedProperty, getProperty, getPropertyNames, getReadProperty, getReadProperty, getReadPropertyNames, getRequiredProperty, getRequiredReadProperty, getRequiredWriteProperty, getTypeArguments, getTypeArguments, getTypeArguments, getWriteProperty, getWriteProperty, instantiate, propertyIndexOfMethods inherited from interface ReflectiveIntrospection
separatesDeclarations
-
Constructor Details
-
SupplementedBeanIntrospection
public SupplementedBeanIntrospection(BeanIntrospection<T> generated, ReflectionBeanIntrospection<T> reflected) Creates an introspection completing a generated one with a reflective one.- Parameters:
generated- The generated introspectionreflected- The reflective introspection of the same type
-
-
Method Details
-
getGenerated
The generated introspection this one completes.- Returns:
- The generated introspection
-
getBeanType
Description copied from interface:BeanIntrospectionThe bean type.- Specified by:
getBeanTypein interfaceBeanInfo<T>- Specified by:
getBeanTypein interfaceBeanIntrospection<T>- Returns:
- The bean type
-
getAnnotationMetadata
Description copied from interface:AnnotationMetadataProviderSupplies the metadata. Defaults toAnnotationMetadata.EMPTY_METADATA.- Specified by:
getAnnotationMetadatain interfaceAnnotationMetadataProvider- Returns:
- The
AnnotationMetadata
-
getIndexedProperties
public Collection<BeanProperty<T,Object>> getIndexedProperties(Class<? extends Annotation> annotationType) Description copied from interface:BeanIntrospectionGet all the bean properties annotated for the given annotation type. If the annotation isIntrospected.indexed()by the given annotation, then it will be included in the resulting list.- Specified by:
getIndexedPropertiesin interfaceBeanIntrospection<T>- Parameters:
annotationType- The annotation type- Returns:
- An immutable collection of properties.
- See Also:
-
getIndexedProperty
public Optional<BeanProperty<T,Object>> getIndexedProperty(Class<? extends Annotation> annotationType, String annotationValue) Description copied from interface:BeanIntrospectionGet all the bean properties annotated for the given type.- Specified by:
getIndexedPropertyin interfaceBeanIntrospection<T>- Parameters:
annotationType- The annotation typeannotationValue- The annotation value- Returns:
- An immutable collection of properties.
- See Also:
-
getBeanMethods
Description copied from interface:BeanIntrospectionReturns theBeanMethodinstances for this introspection.The
BeanMethodinstances are only those methods annotated withio.micronaut.context.annotation.Executableand hence represent a subset of the actual methods of the class and do not include any methods that are exposed asBeanPropertyinstances.- Specified by:
getBeanMethodsin interfaceBeanIntrospection<T>- Returns:
- An immutable collection of methods.
-
findDeclaredMethod
Description copied from interface:ReflectiveIntrospectionFinds the method the introspected type itself declares, with the annotations of that declaration only: the generated metadata of a method merges the annotations of the methods it overrides.- Specified by:
findDeclaredMethodin interfaceReflectiveIntrospection<T>- Parameters:
name- The method nameparameterTypes- The parameter types- Returns:
- The method declared by the type, empty when the type inherits it
-
getConstructorArguments
Description copied from interface:BeanIntrospectionThe constructor arguments needed to instantiate the bean.- Specified by:
getConstructorArgumentsin interfaceBeanIntrospection<T>- Returns:
- An argument array
-
getConstructor
The generated constructor, with the metadata the reflection reads from the constructor when the generated one carries none: a generated introspection instantiates, it does not describe.- Specified by:
getConstructorin interfaceBeanIntrospection<T>- Returns:
- The bean constructor.
-
getConstructors
Description copied from interface:BeanIntrospectionReturns the constructors this introspection describes.By default an introspection only describes the constructor used to instantiate beans, in which case this method returns a singleton list containing
BeanIntrospection.getConstructor(). When the introspected type opts in viaIntrospected.constructors(), or by annotating individual constructors withio.micronaut.context.annotation.Executable, every described constructor is returned, including its own annotation metadata and the annotation metadata of its parameters.A described constructor reports the parameters of its JVM signature, which for a non-static inner class means that
BeanConstructor.getArguments()starts with the implicit enclosing instance, namedthis$0, exactly asConstructor.getParameterTypes()reports it. The enclosing instance must therefore be passed first toBeanConstructor.instantiate(Object...).BeanIntrospection.getConstructor()andBeanIntrospection.getConstructorArguments()keep the source level view and never describe it, so for a non-static inner class the first element of this list does not report the same arguments asBeanIntrospection.getConstructor().- Specified by:
getConstructorsin interfaceBeanIntrospection<T>- Specified by:
getConstructorsin interfaceReflectiveIntrospection<T>- Returns:
- Every constructor of the type,
BeanIntrospection.getConstructor()first
-
getBeanProperties
The generated properties, each with the type arguments the reflection reads from every member: the getter of an interface can declareMap<String, @NotBlank String>where the field is a plainMap<String, String>.- Specified by:
getBeanPropertiesin interfaceBeanIntrospection<T>- Returns:
- An immutable collection of properties.
-
getBeanReadProperties
The read properties the generated introspection reports, each as it reports it, completed by the ones of a property it does not describe at all.A generated introspection that legitimately reads nothing - a type written to and never read from - reads nothing here either: the reflective members of the type do not stand in for the properties it has none of.
- Specified by:
getBeanReadPropertiesin interfaceBeanIntrospection<T>- Returns:
- The read properties
-
getBeanWriteProperties
The write properties the generated introspection reports, each as it reports it, completed by the ones of a property it does not describe at all, the waygetBeanReadProperties()completes the read ones.- Specified by:
getBeanWritePropertiesin interfaceBeanIntrospection<T>- Returns:
- The write properties
-
getProperty
Description copied from interface:BeanIntrospectionObtain a property by name.- Specified by:
getPropertyin interfaceBeanIntrospection<T>- Parameters:
name- The name of the property- Returns:
- A bean property if found
-
instantiate
Description copied from interface:BeanIntrospectionInstantiates an instance of the bean, throwing an exception is instantiation is not possible.- Specified by:
instantiatein interfaceBeanIntrospection<T>- Returns:
- An instance
- Throws:
InstantiationException- If the bean cannot be instantiated or the arguments are not satisfied.
-
instantiate
public T instantiate(boolean strictNullable, @Nullable Object... arguments) throws InstantiationException Description copied from interface:BeanIntrospectionInstantiates an instance of the bean, throwing an exception is instantiation is not possible.- Specified by:
instantiatein interfaceBeanIntrospection<T>- Parameters:
strictNullable- If true, require null parameters to be annotated with a nullable annotationarguments- The arguments required to instantiate bean. Should match the types returned byBeanIntrospection.getConstructorArguments()- Returns:
- An instance
- Throws:
InstantiationException- If the bean cannot be instantiated.
-
isBuildable
public boolean isBuildable()Description copied from interface:BeanIntrospectionCan the introspection be constructed withBeanIntrospection.builder().- Specified by:
isBuildablein interfaceBeanIntrospection<T>- Returns:
- True if it can
-
hasBuilder
public boolean hasBuilder()Description copied from interface:BeanIntrospectionDoes the introspection have a backing builder.This method exists so that consumers can choose to optimize towards direct instantiation using
BeanIntrospection.instantiate()if no builder is present.- Specified by:
hasBuilderin interfaceBeanIntrospection<T>- Returns:
- True if a backing builder is present.
-
builder
- Specified by:
builderin interfaceBeanIntrospection<T>- Returns:
- Obtain a builder for this introspection.
-
toString
-