Package org.mvel2.integration.impl
Class CachedMapVariableResolverFactory
- java.lang.Object
-
- org.mvel2.integration.impl.BaseVariableResolverFactory
-
- org.mvel2.integration.impl.CachedMapVariableResolverFactory
-
- All Implemented Interfaces:
Serializable,VariableResolverFactory
public class CachedMapVariableResolverFactory extends BaseVariableResolverFactory
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Object>variablesHolds the instance of the variables.-
Fields inherited from class org.mvel2.integration.impl.BaseVariableResolverFactory
indexedVariableNames, indexedVariableResolvers, indexOffset, nextFactory, variableResolvers
-
-
Constructor Summary
Constructors Constructor Description CachedMapVariableResolverFactory()CachedMapVariableResolverFactory(Map<String,Object> variables)CachedMapVariableResolverFactory(Map<String,Object> variables, VariableResolverFactory nextFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected VariableResolveraddResolver(String name, VariableResolver vr)VariableResolvercreateVariable(String name, Object value)Creates a new variable.VariableResolvercreateVariable(String name, Object value, Class<?> type)Creates a new variable, and assigns a static type.Set<String>getKnownVariables()Return a list of known variables inside the factory.VariableResolvergetVariableResolver(String name)Return a variable resolver for the specified variable name.booleanisResolveable(String name)Determines whether or not the variable is resolver in the chain of factories.booleanisTarget(String name)Deterimines whether or not the current VariableResolverFactory is the physical target for the actual variable.-
Methods inherited from class org.mvel2.integration.impl.BaseVariableResolverFactory
appendFactory, breakFlag, createIndexedVariable, createIndexedVariable, getIndexedVariableNames, getIndexedVariableResolver, getNextFactory, getVariableResolvers, insertFactory, isIndexedFactory, isNextResolveable, setBreakFlag, setIndexedVariableNames, setIndexedVariableResolver, setNextFactory, setTiltFlag, setVariableResolvers, tiltFlag, variableIndexOf
-
-
-
-
Constructor Detail
-
CachedMapVariableResolverFactory
public CachedMapVariableResolverFactory()
-
CachedMapVariableResolverFactory
public CachedMapVariableResolverFactory(Map<String,Object> variables)
-
CachedMapVariableResolverFactory
public CachedMapVariableResolverFactory(Map<String,Object> variables, VariableResolverFactory nextFactory)
-
-
Method Detail
-
createVariable
public VariableResolver createVariable(String name, Object value)
Description copied from interface:VariableResolverFactoryCreates a new variable. This probably doesn't need to be implemented in most scenarios. This is used for variable assignment.- Parameters:
name- - name of the variable being createdvalue- - value of the variable- Returns:
- instance of the variable resolver associated with the variable
-
createVariable
public VariableResolver createVariable(String name, Object value, Class<?> type)
Description copied from interface:VariableResolverFactoryCreates a new variable, and assigns a static type. It is expected the underlying factory and resolver will enforce this.- Parameters:
name- - name of the variable being createdvalue- - value of the variabletype- - the static type- Returns:
- instance of the variable resolver associated with the variable
-
getVariableResolver
public VariableResolver getVariableResolver(String name)
Description copied from interface:VariableResolverFactoryReturn a variable resolver for the specified variable name. This method is expected to traverse the heirarchy of ResolverFactories.- Specified by:
getVariableResolverin interfaceVariableResolverFactory- Overrides:
getVariableResolverin classBaseVariableResolverFactory- Parameters:
name- - variable name- Returns:
- - instance of the VariableResolver for the specified variable
-
isResolveable
public boolean isResolveable(String name)
Description copied from interface:VariableResolverFactoryDetermines whether or not the variable is resolver in the chain of factories.- Parameters:
name- - variable name- Returns:
- - boolean
-
addResolver
protected VariableResolver addResolver(String name, VariableResolver vr)
-
isTarget
public boolean isTarget(String name)
Description copied from interface:VariableResolverFactoryDeterimines whether or not the current VariableResolverFactory is the physical target for the actual variable.- Parameters:
name- - variable name- Returns:
- - boolean indicating whether or not factory is the physical target
-
getKnownVariables
public Set<String> getKnownVariables()
Description copied from interface:VariableResolverFactoryReturn a list of known variables inside the factory. This method should not recurse into other factories. But rather return only the variables living inside this factory.- Specified by:
getKnownVariablesin interfaceVariableResolverFactory- Overrides:
getKnownVariablesin classBaseVariableResolverFactory- Returns:
- variables
-
-