Class MavenPropertiesImporter

  • All Implemented Interfaces:
    SpecialVariableProcessor

    public class MavenPropertiesImporter
    extends java.lang.Object
    implements SpecialVariableProcessor
    The class imports some properties from the maven which can be accessible from preprocessed sources as global variables
    • Field Detail

      • PATTERN_FOR_PROPERTY_WHICH_CAN_CONTAIN_PRIVATE_INFO

        private static final java.util.regex.Pattern PATTERN_FOR_PROPERTY_WHICH_CAN_CONTAIN_PRIVATE_INFO
      • TO_IMPORT

        private static final java.lang.String[] TO_IMPORT
      • insideVarMap

        private final java.util.Map<java.lang.String,​Value> insideVarMap
      • project

        private final org.apache.maven.project.MavenProject project
    • Constructor Detail

      • MavenPropertiesImporter

        public MavenPropertiesImporter​(PreprocessorContext context,
                                       org.apache.maven.project.MavenProject project,
                                       boolean logAddedProperties)
    • Method Detail

      • printInfoAboutVarIntoLog

        private void printInfoAboutVarIntoLog​(PreprocessorContext context,
                                              java.lang.String varName,
                                              java.lang.String value)
      • addVariableIntoInsideMap

        private void addVariableIntoInsideMap​(PreprocessorContext context,
                                              java.lang.String name,
                                              Value value,
                                              boolean verbose)
      • getProperty

        static java.lang.String getProperty​(org.apache.maven.project.MavenProject project,
                                            java.lang.String name)
      • normalizeGetter

        static java.lang.String normalizeGetter​(java.lang.String str)
      • 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