Class EnvironmentVariableProcessor

  • All Implemented Interfaces:
    SpecialVariableProcessor

    public class EnvironmentVariableProcessor
    extends java.lang.Object
    implements 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 Detail

      • environmentVars

        private final java.util.Map<java.lang.String,​Value> environmentVars
    • Constructor Detail

      • EnvironmentVariableProcessor

        public EnvironmentVariableProcessor()
    • Method Detail

      • getVariableNames

        public java.lang.String[] 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 interface SpecialVariableProcessor
        Returns:
        allowed variable names as a String array
      • getVariable

        public Value getVariable​(java.lang.String varName,
                                 PreprocessorContext context)
        Description copied from interface: SpecialVariableProcessor
        Get the value for the variable
        Specified by:
        getVariable in interface SpecialVariableProcessor
        Parameters:
        varName - the variable name, must not be null
        context - 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

        public void setVariable​(java.lang.String varName,
                                Value value,
                                PreprocessorContext context)
        Description copied from interface: SpecialVariableProcessor
        Set a value to the variable
        Specified by:
        setVariable in interface SpecialVariableProcessor
        Parameters:
        varName - the variable name, must not be null
        value - the value to be set to the variable, must not be null
        context - the preprocessor context, it can be null