Class JoinAliasGenerator

java.lang.Object
io.microsphere.spring.beans.factory.support.JoinAliasGenerator
All Implemented Interfaces:
ConfigurationBeanAliasGenerator
Direct Known Subclasses:
HyphenAliasGenerator, UnderScoreJoinAliasGenerator

public abstract class JoinAliasGenerator extends Object implements ConfigurationBeanAliasGenerator
A ConfigurationBeanAliasGenerator implementation that generates aliases by joining the parts of the prefix with the bean name in a cohesive format.

For example, given a prefix like "user.config" and a bean name "dataSource", it would generate an alias like: userConfig + delimiter() + dataSource, where the delimiter is defined by the implementing subclass.

Since:
1.0.0
Author:
qi.li, Mercy
  • Constructor Details

    • JoinAliasGenerator

      public JoinAliasGenerator()
  • Method Details

    • generateAlias

      public String generateAlias(String prefix, String beanName, Class<?> configClass)
      Description copied from interface: ConfigurationBeanAliasGenerator
      Generates an alias for a configuration bean based on the provided prefix, bean name, and configuration class.

      This method should create a unique and consistent alias by combining the given prefix, bean name, and the simple name of the configuration class. Implementations are expected to handle cases where any of the inputs may be null or empty, ensuring a valid alias is returned.

      Example: Given a prefix of "app", a bean name of "dataSource", and a configuration class named DatabaseConfig, this method might return: "appDataSourceDatabaseConfig".

      Specified by:
      generateAlias in interface ConfigurationBeanAliasGenerator
      Parameters:
      prefix - the prefix to be used in the alias; may be null or empty
      beanName - the name of the bean for which the alias is being generated; must not be null or empty
      configClass - the configuration class associated with the bean; may be null if no specific configuration class is associated
      Returns:
      a generated alias as a String; never null
    • delimiter

      protected abstract String delimiter()