Package org.mvel2.integration
Interface VariableResolverFactory
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
BaseVariableResolverFactory
,CachedMapVariableResolverFactory
,CachingMapVariableResolverFactory
,ClassImportResolverFactory
,DefaultLocalVariableResolverFactory
,FunctionVariableResolverFactory
,ImmutableDefaultFactory
,IndexedVariableResolverFactory
,InvokationContextFactory
,ItemResolverFactory
,MapVariableResolverFactory
,Proto.ProtoContextFactory
,SimpleVariableResolverFactory
,StackDelimiterResolverFactory
,StackDemarcResolverFactory
,StackResetResolverFactory
,StaticMethodImportResolverFactory
,TypeInjectionResolverFactoryImpl
A VariableResolverFactory is the primary integration point for tying in external variables. The factory is
responsible for returing
VariableResolver
's to the MVEL runtime. Factories are
also structured in a chain to maintain locality-of-reference.-
Method Summary
Modifier and TypeMethodDescriptioncreateIndexedVariable
(int index, String name, Object value) createIndexedVariable
(int index, String name, Object value, Class<?> typee) createVariable
(String name, Object value) Creates a new variable.createVariable
(String name, Object value, Class<?> type) Creates a new variable, and assigns a static type.getIndexedVariableResolver
(int index) Return a list of known variables inside the factory.Returns the next factory in the factory chain.getVariableResolver
(String name) Return a variable resolver for the specified variable name.boolean
boolean
isResolveable
(String name) Determines whether or not the variable is resolver in the chain of factories.boolean
Deterimines whether or not the current VariableResolverFactory is the physical target for the actual variable.setIndexedVariableResolver
(int index, VariableResolver variableResolver) setNextFactory
(VariableResolverFactory resolverFactory) Sets the next factory in the chain.void
setTiltFlag
(boolean tilt) boolean
tiltFlag()
int
variableIndexOf
(String name)
-
Method Details
-
createVariable
Creates 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
-
createIndexedVariable
-
createVariable
Creates 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
-
createIndexedVariable
-
setIndexedVariableResolver
-
getNextFactory
VariableResolverFactory getNextFactory()Returns the next factory in the factory chain. MVEL uses a hierarchical variable resolution strategy, much in the same way as Classloaders in Java. For performance reasons, it is the responsibility of the individual VariableResolverFactory to pass off to the next one.- Returns:
- instance of the next factory - null if none.
-
setNextFactory
Sets the next factory in the chain. Proper implementation:return this.nextFactory = resolverFactory;
- Parameters:
resolverFactory
- - instance of next resolver factory- Returns:
- - instance of next resolver factory
-
getVariableResolver
Return a variable resolver for the specified variable name. This method is expected to traverse the heirarchy of ResolverFactories.- Parameters:
name
- - variable name- Returns:
- - instance of the VariableResolver for the specified variable
-
getIndexedVariableResolver
-
isTarget
Deterimines 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
-
isResolveable
Determines whether or not the variable is resolver in the chain of factories.- Parameters:
name
- - variable name- Returns:
- - boolean
-
getKnownVariables
Return 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.- Returns:
- variables
-
variableIndexOf
-
isIndexedFactory
boolean isIndexedFactory() -
tiltFlag
boolean tiltFlag() -
setTiltFlag
void setTiltFlag(boolean tilt)
-