Class ServiceBeanNameAnnotationResolver
java.lang.Object
com.bobocode.bring.core.annotation.resolver.impl.ServiceBeanNameAnnotationResolver
- All Implemented Interfaces:
AnnotationResolver
An implementation of AnnotationResolver specifically designed for resolving
bean names associated with classes annotated with @Service.
This resolver checks for the presence of the Service annotation on a class
and extracts the associated value or default class name as the bean name.
Example usage: This resolver is tailored to handle classes annotated with @Service, allowing extraction of a specified value from the annotation or using the class's simple name as the default bean name.
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
isSupported
(Class<?> clazz) Checks if the resolver supports handling annotations on the specified class.Resolves the bean name based on the @Service 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
-
ServiceBeanNameAnnotationResolver
public ServiceBeanNameAnnotationResolver()
-
-
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 Service annotation- Returns:
- true if the Service annotation is present on the class; false otherwise
-
resolve
Resolves the bean name based on the @Service annotation. If the Service 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 bean name- Returns:
- the resolved bean name
-