public class SimpleAliasRegistry extends java.lang.Object implements AliasRegistry
AliasRegistry
interface.
Serves as base class for
BeanDefinitionRegistry
implementations.Modifier and Type | Field and Description |
---|---|
protected Log |
logger
Logger available to subclasses.
|
Constructor and Description |
---|
SimpleAliasRegistry() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
allowAliasOverriding()
Return whether alias overriding is allowed.
|
java.lang.String |
canonicalName(java.lang.String name)
Determine the raw name, resolving aliases to canonical names.
|
protected void |
checkForAliasCircle(java.lang.String name,
java.lang.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.
|
java.lang.String[] |
getAliases(java.lang.String name)
Return the aliases for the given name, if defined.
|
boolean |
hasAlias(java.lang.String name,
java.lang.String alias)
Determine whether the given name has the given alias registered.
|
boolean |
isAlias(java.lang.String name)
Determine whether this given name is defines as an alias
(as opposed to the name of an actually registered component).
|
void |
registerAlias(java.lang.String name,
java.lang.String alias)
Given a name, register an alias for it.
|
void |
removeAlias(java.lang.String alias)
Remove the specified alias from this registry.
|
void |
resolveAliases(StringValueResolver valueResolver)
Resolve all alias target names and aliases registered in this
factory, applying the given StringValueResolver to them.
|
protected final Log logger
public void registerAlias(java.lang.String name, java.lang.String alias)
AliasRegistry
registerAlias
in interface AliasRegistry
name
- the canonical namealias
- the alias to be registeredprotected boolean allowAliasOverriding()
true
.public boolean hasAlias(java.lang.String name, java.lang.String alias)
name
- the name to checkalias
- the alias to look forpublic void removeAlias(java.lang.String alias)
AliasRegistry
removeAlias
in interface AliasRegistry
alias
- the alias to removepublic boolean isAlias(java.lang.String name)
AliasRegistry
isAlias
in interface AliasRegistry
name
- the name to checkpublic java.lang.String[] getAliases(java.lang.String name)
AliasRegistry
getAliases
in interface AliasRegistry
name
- the name to check for aliasespublic void resolveAliases(StringValueResolver valueResolver)
The value resolver may for example resolve placeholders in target bean names and even in alias names.
valueResolver
- the StringValueResolver to applyprotected void checkForAliasCircle(java.lang.String name, java.lang.String alias)
name
- the candidate namealias
- the candidate aliasregisterAlias(java.lang.String, java.lang.String)
,
hasAlias(java.lang.String, java.lang.String)
public java.lang.String canonicalName(java.lang.String name)
name
- the user-specified name