Class ComponentBeanNameAnnotationResolver
java.lang.Object
com.bobocode.bring.core.annotation.resolver.impl.ComponentBeanNameAnnotationResolver
- All Implemented Interfaces:
AnnotationResolver
An implementation of AnnotationResolver specifically designed for resolving
component bean names based on the Component annotation.
This resolver checks for the presence of the Component annotation on a class
and extracts the associated value or default class name as the bean name.
Example usage: This resolver can be used in a framework or system where component names are defined using the Component annotation, allowing automatic resolution of bean names based on annotated classes.
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate String
getQualifier
(Class<?> clazz) boolean
isSupported
(Class<?> clazz) Checks if the resolver supports handling annotations on the specified class.Resolves the component bean name based on the Component annotation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.bobocode.bring.core.annotation.resolver.AnnotationResolver
getSimpleName
-
Constructor Details
-
ComponentBeanNameAnnotationResolver
public ComponentBeanNameAnnotationResolver()
-
-
Method Details
-
isSupported
Checks if the resolver supports handling annotations on the specified class.- Specified by:
isSupported
in interfaceAnnotationResolver
- Parameters:
clazz
- the class to check for Component annotation- Returns:
- true if the Component annotation is present on the class; false otherwise
-
resolve
Resolves the component bean name based on the Component annotation. If the Component annotation includes a value, that value is returned as the bean name. Otherwise, the simple class name is used as the default bean name.- Specified by:
resolve
in interfaceAnnotationResolver
- Parameters:
clazz
- the class for which to resolve the component bean name- Returns:
- the resolved component bean name
-
getQualifier
-