Class ComponentBeanNameAnnotationResolver

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

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

    • ComponentBeanNameAnnotationResolver

      public ComponentBeanNameAnnotationResolver()
  • 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 Component annotation
      Returns:
      true if the Component annotation is present on the class; false otherwise
    • resolve

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

      private String getQualifier(Class<?> clazz)