Package io.micronaut.core.beans
Interface BeanIntrospector
public interface BeanIntrospector
Primary interface for obtaining
BeanIntrospection instances that are computed at compilation time.- Since:
- 1.0
- Author:
- graemerocher
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BeanIntrospectorThe default sharedBeanIntrospector. -
Method Summary
Modifier and TypeMethodDescription@NonNull Collection<Class<?>>findIntrospectedTypes(@NonNull Predicate<? super BeanIntrospectionReference<?>> filter) Finds introspections with the given filter.<T> @NonNull Optional<BeanIntrospection<T>>findIntrospection(@NonNull Class<T> beanType) Find aBeanIntrospectionfor the given bean type.default @NonNull Collection<BeanIntrospection<Object>>findIntrospections(@NonNull Class<? extends Annotation> stereotype) Finds introspections for classes annotated with the given stereotype.default @NonNull Collection<BeanIntrospection<Object>>findIntrospections(@NonNull Class<? extends Annotation> stereotype, @NonNull String... packageNames) Finds introspections for classes annotated with the given stereotype.findIntrospections(@NonNull Predicate<? super BeanIntrospectionReference<?>> filter) Finds introspections with the given filter.static BeanIntrospectorforClassLoader(ClassLoader classLoader) Creates a new default bean introspector that uses the given classloader.default <T> @NonNull BeanIntrospection<T>getIntrospection(@NonNull Class<T> beanType) Retrieves an introspection for the given type.
-
Field Details
-
SHARED
The default sharedBeanIntrospector.
-
-
Method Details
-
forClassLoader
Creates a new default bean introspector that uses the given classloader.- Parameters:
classLoader- The class loader to load introspections- Returns:
- A new bean introspector
- Since:
- 3.0.1
-
findIntrospections
@NonNull @NonNull Collection<BeanIntrospection<Object>> findIntrospections(@NonNull @NonNull Predicate<? super BeanIntrospectionReference<?>> filter) Finds introspections with the given filter.- Parameters:
filter- A filter that receives aBeanIntrospectionReference- Returns:
- A collection of introspections
-
findIntrospectedTypes
@NonNull @NonNull Collection<Class<?>> findIntrospectedTypes(@NonNull @NonNull Predicate<? super BeanIntrospectionReference<?>> filter) Finds introspections with the given filter.- Parameters:
filter- A filter that receives aBeanIntrospectionReference- Returns:
- A collection of introspections
- Since:
- 3.0
-
findIntrospection
@NonNull <T> @NonNull Optional<BeanIntrospection<T>> findIntrospection(@NonNull @NonNull Class<T> beanType) Find aBeanIntrospectionfor the given bean type.- Type Parameters:
T- The bean generic type- Parameters:
beanType- The bean type- Returns:
- An optional introspection
-
findIntrospections
@NonNull default @NonNull Collection<BeanIntrospection<Object>> findIntrospections(@NonNull @NonNull Class<? extends Annotation> stereotype) Finds introspections for classes annotated with the given stereotype.- Parameters:
stereotype- The stereotype- Returns:
- The introspections
-
findIntrospections
@NonNull default @NonNull Collection<BeanIntrospection<Object>> findIntrospections(@NonNull @NonNull Class<? extends Annotation> stereotype, @NonNull @NonNull String... packageNames) Finds introspections for classes annotated with the given stereotype.- Parameters:
stereotype- The stereotypepackageNames- The package names to include in the search- Returns:
- The introspections
-
getIntrospection
@NonNull default <T> @NonNull BeanIntrospection<T> getIntrospection(@NonNull @NonNull Class<T> beanType) Retrieves an introspection for the given type.- Type Parameters:
T- The bean generic type- Parameters:
beanType- The bean type- Returns:
- The introspection
- Throws:
IntrospectionException- If no introspection data is found and the bean is not annotated withIntrospected
-