T - The bean type@Immutable public interface BeanIntrospection<T> extends AnnotationMetadataDelegate
BeanIntrospection is the result of compile time computation of a beans properties and annotation metadata.
This interface allows you to instantiate and read and write to bean properties without using reflection or caching reflective metadata, which is expensive from a memory consumption perspective.
BeanIntrospection instances can be obtained either via getIntrospection(Class) or via the BeanIntrospector.
A BeanIntrospection is only computed at compilation time if the class is annotated with Introspected.
BeanIntrospector,
IntrospectedCLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBEREMPTY| Modifier and Type | Method and Description |
|---|---|
Collection<BeanProperty<T,Object>> |
getBeanProperties() |
Class<T> |
getBeanType()
The bean type.
|
default Argument<?>[] |
getConstructorArguments()
The constructor arguments needed to instantiate the bean.
|
Collection<BeanProperty<T,Object>> |
getIndexedProperties(Class<? extends Annotation> annotationType)
Get all the bean properties annotated for the given annotation type.
|
default Optional<BeanProperty<T,Object>> |
getIndexedProperty(Class<? extends Annotation> annotationType)
Get all the bean properties annotated for the given type.
|
Optional<BeanProperty<T,Object>> |
getIndexedProperty(Class<? extends Annotation> annotationType,
String annotationValue)
Get all the bean properties annotated for the given type.
|
static <T2> BeanIntrospection<T2> |
getIntrospection(Class<T2> type)
Obtains an introspection from the default
BeanIntrospector. |
default Optional<BeanProperty<T,Object>> |
getProperty(String name)
Obtain a property by name.
|
default <P> Optional<BeanProperty<T,P>> |
getProperty(String name,
Class<P> type)
Obtain a property by name and type.
|
default String[] |
getPropertyNames()
The property names as an array.
|
default <P> BeanProperty<T,P> |
getRequiredProperty(String name,
Class<P> type)
Gets a property of the given name and type or throws
IntrospectionException if the property is not present. |
T |
instantiate()
Instantiates an instance of the bean, throwing an exception is instantiation is not possible.
|
T |
instantiate(Object... arguments)
Instantiates an instance of the bean, throwing an exception is instantiation is not possible.
|
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByType, 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, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByTypegetAnnotationMetadatahasSimpleAnnotation, hasSimpleDeclaredAnnotation@Nonnull Collection<BeanProperty<T,Object>> getBeanProperties()
@Nonnull Collection<BeanProperty<T,Object>> getIndexedProperties(@Nonnull Class<? extends Annotation> annotationType)
Introspected.indexed() by the given annotation,
then it will be included in the resulting list.annotationType - The annotation typeIntrospected.indexed()@Nonnull T instantiate() throws InstantiationException
InstantiationException - If the bean cannot be insantiated or the arguments are not satisfied.@Nonnull T instantiate(Object... arguments) throws InstantiationException
arguments - The arguments required to instantiate bean. Should match the types returned by getConstructorArguments()InstantiationException - If the bean cannot be instantiated.@Nonnull Optional<BeanProperty<T,Object>> getIndexedProperty(@Nonnull Class<? extends Annotation> annotationType, @Nonnull String annotationValue)
annotationType - The annotation typeannotationValue - The annotation valueIntrospected.indexed()@Nonnull default Optional<BeanProperty<T,Object>> getIndexedProperty(@Nonnull Class<? extends Annotation> annotationType)
annotationType - The annotation typeIntrospected.indexed()@Nonnull default Argument<?>[] getConstructorArguments()
@Nonnull default Optional<BeanProperty<T,Object>> getProperty(@Nonnull String name)
name - The name of the property@Nonnull default <P> BeanProperty<T,P> getRequiredProperty(@Nonnull String name, @Nonnull Class<P> type)
IntrospectionException if the property is not present.P - The property generic typename - The nametype - The type@Nonnull default <P> Optional<BeanProperty<T,P>> getProperty(@Nonnull String name, @Nonnull Class<P> type)
P - The property typename - The name of the propertytype - The property type to search for@Nonnull default String[] getPropertyNames()
static <T2> BeanIntrospection<T2> getIntrospection(Class<T2> type)
BeanIntrospector.T2 - The generic typetype - The typeIntrospectionException - If the introspection cannot be found or errors when loading