Package com.igormaznitsa.jcp.context
Class EnvironmentVariableProcessor
java.lang.Object
com.igormaznitsa.jcp.context.EnvironmentVariableProcessor
- All Implemented Interfaces:
SpecialVariableProcessor
The class allows to get access to environment variables from preprocessor
expression, the variables have the "env." prefix and all them are String type
All environment variables are allowed for reading and disallowing for writing
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetVariable
(String varName, PreprocessorContext context) Get the value for the variableString[]
Get all variable names allowed by the processor as an array, all names must be in lower casevoid
setVariable
(String varName, Value value, PreprocessorContext context) Set a value to the variable
-
Field Details
-
PREFIX
- See Also:
-
environmentVars
-
-
Constructor Details
-
EnvironmentVariableProcessor
public EnvironmentVariableProcessor()
-
-
Method Details
-
getVariableNames
Description copied from interface:SpecialVariableProcessor
Get all variable names allowed by the processor as an array, all names must be in lower case- Specified by:
getVariableNames
in interfaceSpecialVariableProcessor
- Returns:
- allowed variable names as a String array
-
getVariable
Description copied from interface:SpecialVariableProcessor
Get the value for the variable- Specified by:
getVariable
in interfaceSpecialVariableProcessor
- Parameters:
varName
- the variable name, must not be nullcontext
- the preprocessor context, it can be null- Returns:
- the value, it must not return null because it will notified preprocessor that it supports the variable
-
setVariable
Description copied from interface:SpecialVariableProcessor
Set a value to the variable- Specified by:
setVariable
in interfaceSpecialVariableProcessor
- Parameters:
varName
- the variable name, must not be nullvalue
- the value to be set to the variable, must not be nullcontext
- the preprocessor context, it can be null
-