Class ServiceBeanNameAnnotationResolver

java.lang.Object
com.bobocode.bring.core.annotation.resolver.impl.ServiceBeanNameAnnotationResolver
All Implemented Interfaces:
AnnotationResolver

public class ServiceBeanNameAnnotationResolver extends Object implements 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 Details

    • ServiceBeanNameAnnotationResolver

      public ServiceBeanNameAnnotationResolver()
  • Method Details

    • isSupported

      public boolean isSupported(Class<?> clazz)
      Checks if the resolver supports handling annotations on the specified class.
      Specified by:
      isSupported in interface AnnotationResolver
      Parameters:
      clazz - the class to check for Service annotation
      Returns:
      true if the Service annotation is present on the class; false otherwise
    • resolve

      public String resolve(Class<?> clazz)
      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 interface AnnotationResolver
      Parameters:
      clazz - the class for which to resolve the bean name
      Returns:
      the resolved bean name