Class ReplacementProperty

java.lang.Object
pl.project13.maven.git.ReplacementProperty

public class ReplacementProperty extends Object
This class represents a specific property replacement the user wants to perform. For a use-case refer to https://github.com/git-commit-id/git-commit-id-maven-plugin/issues/317.
Since:
2.2.3
  • Constructor Details

    • ReplacementProperty

      public ReplacementProperty()
      Empty constructor.
    • ReplacementProperty

      public ReplacementProperty(String property, String propertyOutputSuffix, String token, String value, boolean regex, boolean forceValueEvaluation, List<TransformationRule> transformationRules)
      Constructs a specific property replacement the user wants to perform.
      Parameters:
      property - The source (input) property on which the replacements should be performed (e.g. git.branch)
      propertyOutputSuffix - The property output suffix where the replacement result should be stored in (e.g. git.branch-no-slashes)
      token - The replacement token acts as needle that will be searched in the input property (e.g. ^([^\/]*)\/([^\/]*)$)
      value - The value acts as the text to be written over any found tokens ("replacement").
      regex - If true the replacement will be performed with regular expressions or, if false performs a replacement with java's string.replace-function.
      forceValueEvaluation - If true forces the plugin to evaluate the given value on *every* project. This might come handy if *every* project needs a unique value and a user wants to project specific variables like project.artifactId.
      transformationRules - The list of transformation-rules that should be applied during replacement.
  • Method Details

    • getProperty

      public String getProperty()
      The source (input) property on which the replacements should be performed.
      Returns:
      The source (input) property on which the replacements should be performed (e.g. git.branch)
    • setProperty

      public void setProperty(String property)
      Set the source (input) property on which the replacements should be performed (e.g. git.branch)
      Parameters:
      property - The source (input) property
    • getPropertyOutputSuffix

      public String getPropertyOutputSuffix()
      The property output suffix where the replacement result should be stored in.
      Returns:
      The property output suffix where the replacement result should be stored in (e.g. git.branch-no-slashes)
    • setPropertyOutputSuffix

      public void setPropertyOutputSuffix(String propertyOutputSuffix)
      Set the property output suffix where the replacement result should be stored in (e.g. git.branch-no-slashes)
      Parameters:
      propertyOutputSuffix - The property output suffix
    • getToken

      public String getToken()
      The replacement token acts as needle that will be searched in the input property.
      Returns:
      The replacement token acts as needle that will be searched in the input property (e.g. ^([^\/]*)\/([^\/]*)$)
    • setToken

      public void setToken(String token)
      Set the replacement token.
      Parameters:
      token - The replacement token
    • getValue

      public String getValue()
      The value that acts as the text to be written over any found tokens.
      Returns:
      The value that acts as the text to be written over any found tokens ("replacement").
    • setValue

      public void setValue(String value)
      Sets the value that acts as the text to be written over any found tokens ("replacement").
      Parameters:
      value - The replacment value
    • isRegex

      public boolean isRegex()
      Indicator if the replacement will be performed with regular expressions.
      Returns:
      Indicator if the replacement will be performed with regular expressions (true) or, if a replacement with java's string.replace-function is performed (false).
    • setRegex

      public void setRegex(boolean regex)
      Sets Indicator if the replacement will be performed with regular expressions (true) or, if a replacement with java's string.replace-function is performed (false).
      Parameters:
      regex - Indicator
    • isForceValueEvaluation

      public boolean isForceValueEvaluation()
      Indicator if the plugin forces to evaluate the given value on every project.
      Returns:
      Indicator if the plugin forces to evaluate the given value on every project.
    • setForceValueEvaluation

      public void setForceValueEvaluation(boolean forceValueEvaluation)
      Sets Indicator if the plugin forces to evaluate the given value on every project.
      Parameters:
      forceValueEvaluation - Indicator if the plugin forces to evaluate the given value on every project (true).
    • getTransformationRules

      public List<TransformationRule> getTransformationRules()
      The list of transformation-rules that should be applied during replacement.
      Returns:
      The list of transformation-rules that should be applied during replacement.
    • setTransformationRules

      public void setTransformationRules(List<TransformationRule> transformationRules)
      Sets the list of transformation-rules that should be applied during replacement.
      Parameters:
      transformationRules - The list of transformation-rules