Package com.igormaznitsa.jcp.maven
Class MavenPropertiesImporter
- java.lang.Object
-
- com.igormaznitsa.jcp.maven.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 Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,Value>
insideVarMap
private static java.util.regex.Pattern
PATTERN_FOR_PROPERTY_WHICH_CAN_CONTAIN_PRIVATE_INFO
private org.apache.maven.project.MavenProject
project
private static java.lang.String[]
TO_IMPORT
-
Constructor Summary
Constructors Constructor Description MavenPropertiesImporter(PreprocessorContext context, org.apache.maven.project.MavenProject project)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addVariableIntoInsideMap(PreprocessorContext context, java.lang.String name, Value value)
(package private) static java.lang.String
getProperty(org.apache.maven.project.MavenProject project, java.lang.String name)
Value
getVariable(java.lang.String varName, PreprocessorContext context)
Get the value for the variablejava.lang.String[]
getVariableNames()
Get all variable names allowed by the processor as an array, all names must be in lower case(package private) static java.lang.String
normalizeGetter(java.lang.String str)
private void
printInfoAboutVarIntoLog(PreprocessorContext context, java.lang.String varName, java.lang.String value)
void
setVariable(java.lang.String varName, Value value, PreprocessorContext context)
Set a value to the variable
-
-
-
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)
-
-
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)
-
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)
-
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 interfaceSpecialVariableProcessor
- 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 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
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 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
-
-