public class VariableResolverPool extends java.lang.Object implements VariableResolver
Constructor and Description |
---|
VariableResolverPool()
Initialize the new instance with default values.
|
VariableResolverPool(java.util.Map<java.lang.String,VariableResolver> aMap)
Initialize the new instance with the given map to hold the pooled objects.
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String resolverName,
VariableResolver resolver)
Add the given resolver under the given name to the pool.
|
protected java.util.Map<java.lang.String,VariableResolver> |
createNewPool()
Returns a new instance for the pool.
|
protected VariableResolver |
findResolverFor(java.lang.String varName)
Returns the resolver from the pool, that knows the given variable name.
|
protected java.util.Map<java.lang.String,VariableResolver> |
getPool() |
java.lang.Object |
getValue(java.lang.String varName)
Returns the value for the variable with the given name.
|
boolean |
isKnownVariable(java.lang.String varName)
Returns if the variable with the given name can be resolved by the receiver.
|
java.util.Set<java.lang.String> |
knownVariableNames()
Returns all variable name the resolver currently knows
|
void |
remove(java.lang.String resolverName)
Remove the resolver with the given name from the pool.
|
void |
replace(java.lang.String resolverName,
VariableResolver resolver)
Replace the resolver under the given name to the pool.
|
VariableResolver |
resolverNamed(java.lang.String resolverName)
Return the resolver that was registered under the specified name
in this pool.
|
protected void |
setPool(java.util.Map<java.lang.String,VariableResolver> aValue) |
public VariableResolverPool()
public VariableResolverPool(java.util.Map<java.lang.String,VariableResolver> aMap)
aMap
- The instance of a Map interface compliant class.public java.lang.Object getValue(java.lang.String varName) throws UnknownVariableException
getValue
in interface VariableResolver
varName
- The case sensitive name of the variable.UnknownVariableException
- The receiver is not knowing the variable.public boolean isKnownVariable(java.lang.String varName)
isKnownVariable
in interface VariableResolver
varName
- The case sensitive name of the variable.public java.util.Set<java.lang.String> knownVariableNames()
knownVariableNames
in interface VariableResolver
public void add(java.lang.String resolverName, VariableResolver resolver)
resolverName
- The unique name of the resolver in the pool.resolver
- The variable resolver to add.public void replace(java.lang.String resolverName, VariableResolver resolver)
resolverName
- The unique name of the resolver in the pool.resolver
- The replacing variable resolver.public void remove(java.lang.String resolverName)
resolverName
- The unique name of the resolver in the pool.public VariableResolver resolverNamed(java.lang.String resolverName)
resolverName
- The unique name of the resolver in the pool.protected VariableResolver findResolverFor(java.lang.String varName)
varName
- The name of the variable to look forprotected java.util.Map<java.lang.String,VariableResolver> createNewPool()
protected java.util.Map<java.lang.String,VariableResolver> getPool()
protected void setPool(java.util.Map<java.lang.String,VariableResolver> aValue)