Package org.mvel2.integration.impl
Class ImmutableDefaultFactory
java.lang.Object
org.mvel2.integration.impl.ImmutableDefaultFactory
- All Implemented Interfaces:
Serializable
,VariableResolverFactory
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
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) private void
boolean
tiltFlag()
int
variableIndexOf
(String name)
-
Field Details
-
tiltFlag
private boolean tiltFlag
-
-
Constructor Details
-
ImmutableDefaultFactory
public ImmutableDefaultFactory()
-
-
Method Details
-
throwError
private void throwError() -
createVariable
Description copied from interface:VariableResolverFactory
Creates a new variable. This probably doesn't need to be implemented in most scenarios. This is used for variable assignment.- Specified by:
createVariable
in interfaceVariableResolverFactory
- Parameters:
name
- - name of the variable being createdvalue
- - value of the variable- Returns:
- instance of the variable resolver associated with the variable
-
createIndexedVariable
- Specified by:
createIndexedVariable
in interfaceVariableResolverFactory
-
createVariable
Description copied from interface:VariableResolverFactory
Creates a new variable, and assigns a static type. It is expected the underlying factory and resolver will enforce this.- Specified by:
createVariable
in interfaceVariableResolverFactory
- 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
- Specified by:
createIndexedVariable
in interfaceVariableResolverFactory
-
setIndexedVariableResolver
- Specified by:
setIndexedVariableResolver
in interfaceVariableResolverFactory
-
getNextFactory
Description copied from interface:VariableResolverFactory
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.- Specified by:
getNextFactory
in interfaceVariableResolverFactory
- Returns:
- instance of the next factory - null if none.
-
setNextFactory
Description copied from interface:VariableResolverFactory
Sets the next factory in the chain. Proper implementation:return this.nextFactory = resolverFactory;
- Specified by:
setNextFactory
in interfaceVariableResolverFactory
- Parameters:
resolverFactory
- - instance of next resolver factory- Returns:
- - instance of next resolver factory
-
getVariableResolver
Description copied from interface:VariableResolverFactory
Return a variable resolver for the specified variable name. This method is expected to traverse the heirarchy of ResolverFactories.- Specified by:
getVariableResolver
in interfaceVariableResolverFactory
- Parameters:
name
- - variable name- Returns:
- - instance of the VariableResolver for the specified variable
-
getIndexedVariableResolver
- Specified by:
getIndexedVariableResolver
in interfaceVariableResolverFactory
-
isTarget
Description copied from interface:VariableResolverFactory
Deterimines whether or not the current VariableResolverFactory is the physical target for the actual variable.- Specified by:
isTarget
in interfaceVariableResolverFactory
- Parameters:
name
- - variable name- Returns:
- - boolean indicating whether or not factory is the physical target
-
isResolveable
Description copied from interface:VariableResolverFactory
Determines whether or not the variable is resolver in the chain of factories.- Specified by:
isResolveable
in interfaceVariableResolverFactory
- Parameters:
name
- - variable name- Returns:
- - boolean
-
getKnownVariables
Description copied from interface:VariableResolverFactory
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.- Specified by:
getKnownVariables
in interfaceVariableResolverFactory
- Returns:
- variables
-
variableIndexOf
- Specified by:
variableIndexOf
in interfaceVariableResolverFactory
-
isIndexedFactory
public boolean isIndexedFactory()- Specified by:
isIndexedFactory
in interfaceVariableResolverFactory
-
tiltFlag
public boolean tiltFlag()- Specified by:
tiltFlag
in interfaceVariableResolverFactory
-
setTiltFlag
public void setTiltFlag(boolean tilt) - Specified by:
setTiltFlag
in interfaceVariableResolverFactory
-