类 SimpleAliasRegistry
- java.lang.Object
- org.springframework.core.SimpleAliasRegistry
- 所有已实现的接口:
AliasRegistry
public class SimpleAliasRegistry extends Object implements AliasRegistry
Simple implementation of theAliasRegistry
interface.Serves as base class for
BeanDefinitionRegistry
implementations.- 从以下版本开始:
- 2.5.2
- 作者:
- Juergen Hoeller, Qimiao Chen
构造器概要
构造器 构造器 说明 SimpleAliasRegistry()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected boolean
allowAliasOverriding()
Determine whether alias overriding is allowed.String
canonicalName(String name)
Determine the raw name, resolving aliases to canonical names.protected void
checkForAliasCircle(String name, String alias)
Check whether the given name points back to the given alias as an alias in the other direction already, catching a circular reference upfront and throwing a corresponding IllegalStateException.String[]
getAliases(String name)
Return the aliases for the given name, if defined.boolean
hasAlias(String name, String alias)
Determine whether the given name has the given alias registered.boolean
isAlias(String name)
Determine whether the given name is defined as an alias (as opposed to the name of an actually registered component).void
registerAlias(String name, String alias)
Given a name, register an alias for it.void
removeAlias(String alias)
Remove the specified alias from this registry.void
resolveAliases(StringValueResolver valueResolver)
Resolve all alias target names and aliases registered in this registry, applying the givenStringValueResolver
to them.
构造器详细资料
SimpleAliasRegistry
public SimpleAliasRegistry()
方法详细资料
registerAlias
public void registerAlias(String name, String alias)
从接口复制的说明:AliasRegistry
Given a name, register an alias for it.- 指定者:
registerAlias
在接口中AliasRegistry
- 参数:
name
- the canonical namealias
- the alias to be registered
allowAliasOverriding
protected boolean allowAliasOverriding()
Determine whether alias overriding is allowed.Default is
true
.
hasAlias
public boolean hasAlias(String name, String alias)
Determine whether the given name has the given alias registered.- 参数:
name
- the name to checkalias
- the alias to look for- 从以下版本开始:
- 4.2.1
removeAlias
public void removeAlias(String alias)
从接口复制的说明:AliasRegistry
Remove the specified alias from this registry.- 指定者:
removeAlias
在接口中AliasRegistry
- 参数:
alias
- the alias to remove
isAlias
public boolean isAlias(String name)
从接口复制的说明:AliasRegistry
Determine whether the given name is defined as an alias (as opposed to the name of an actually registered component).- 指定者:
isAlias
在接口中AliasRegistry
- 参数:
name
- the name to check- 返回:
- whether the given name is an alias
getAliases
public String[] getAliases(String name)
从接口复制的说明:AliasRegistry
Return the aliases for the given name, if defined.- 指定者:
getAliases
在接口中AliasRegistry
- 参数:
name
- the name to check for aliases- 返回:
- the aliases, or an empty array if none
resolveAliases
public void resolveAliases(StringValueResolver valueResolver)
Resolve all alias target names and aliases registered in this registry, applying the givenStringValueResolver
to them.The value resolver may for example resolve placeholders in target bean names and even in alias names.
- 参数:
valueResolver
- the StringValueResolver to apply
checkForAliasCircle
protected void checkForAliasCircle(String name, String alias)
Check whether the given name points back to the given alias as an alias in the other direction already, catching a circular reference upfront and throwing a corresponding IllegalStateException.- 参数:
name
- the candidate namealias
- the candidate alias- 另请参阅:
registerAlias(java.lang.String, java.lang.String)
,hasAlias(java.lang.String, java.lang.String)
canonicalName
public String canonicalName(String name)
Determine the raw name, resolving aliases to canonical names.- 参数:
name
- the user-specified name- 返回:
- the transformed name