Class ConditionFunctions
java.lang.Object
org.apache.maven.internal.impl.model.profile.ConditionFunctions
Provides a set of functions for evaluating profile activation conditions.
These functions can be used in profile activation expressions to determine
whether a profile should be activated based on various criteria.
-
Constructor Summary
ConstructorDescriptionConditionFunctions
(ProfileActivationContext context, VersionParser versionParser) Constructs a new ConditionFunctions instance. -
Method Summary
Modifier and TypeMethodDescriptionChecks if a string contains a given substring.Checks if a file or directory exists at the given path.Implements an if-then-else operation.Finds the index of a substring within a string.Checks if a version is within a specified version range.Returns the length of the given string.Converts the given string to lowercase.Checks if a string matches a given regular expression.Checks if a file or directory is missing at the given path.Negates a boolean value.Returns a substring of the given string.Converts the given string to uppercase.
-
Constructor Details
-
ConditionFunctions
Constructs a new ConditionFunctions instance.- Parameters:
context
- The profile activation contextversionParser
- The version parser for comparing versions
-
-
Method Details
-
length
Returns the length of the given string.- Parameters:
args
- A list containing a single string argument- Returns:
- The length of the string
- Throws:
IllegalArgumentException
- if the number of arguments is not exactly one
-
upper
Converts the given string to uppercase.- Parameters:
args
- A list containing a single string argument- Returns:
- The uppercase version of the input string
- Throws:
IllegalArgumentException
- if the number of arguments is not exactly one
-
lower
Converts the given string to lowercase.- Parameters:
args
- A list containing a single string argument- Returns:
- The lowercase version of the input string
- Throws:
IllegalArgumentException
- if the number of arguments is not exactly one
-
substring
Returns a substring of the given string.- Parameters:
args
- A list containing 2 or 3 arguments: the string, start index, and optionally end index- Returns:
- The substring
- Throws:
IllegalArgumentException
- if the number of arguments is not 2 or 3
-
indexOf
Finds the index of a substring within a string.- Parameters:
args
- A list containing two strings: the main string and the substring to find- Returns:
- The index of the substring, or -1 if not found
- Throws:
IllegalArgumentException
- if the number of arguments is not exactly two
-
contains
Checks if a string contains a given substring.- Parameters:
args
- A list containing two strings: the main string and the substring to check- Returns:
- true if the main string contains the substring, false otherwise
- Throws:
IllegalArgumentException
- if the number of arguments is not exactly two
-
matches
Checks if a string matches a given regular expression.- Parameters:
args
- A list containing two strings: the string to check and the regex pattern- Returns:
- true if the string matches the regex, false otherwise
- Throws:
IllegalArgumentException
- if the number of arguments is not exactly two
-
not
Negates a boolean value.- Parameters:
args
- A list containing a single boolean argument- Returns:
- The negation of the input boolean
- Throws:
IllegalArgumentException
- if the number of arguments is not exactly one
-
if_
Implements an if-then-else operation.- Parameters:
args
- A list containing three arguments: condition, value if true, value if false- Returns:
- The second argument if the condition is true, the third argument otherwise
- Throws:
IllegalArgumentException
- if the number of arguments is not exactly three
-
exists
Checks if a file or directory exists at the given path.- Parameters:
args
- A list containing a single string argument representing the path- Returns:
true
if the file or directory exists,false
otherwise- Throws:
IllegalArgumentException
- if the number of arguments is not exactly oneModelBuilderException
- if a problem occurs while walking the file systemInterpolatorException
- if an error occurs during interpolation
-
missing
Checks if a file or directory is missing at the given path.- Parameters:
args
- A list containing a single string argument representing the path- Returns:
true
if the file or directory does not exist,false
otherwise- Throws:
IllegalArgumentException
- if the number of arguments is not exactly oneModelBuilderException
- if a problem occurs while walking the file systemInterpolatorException
- if an error occurs during interpolation
-
inrange
Checks if a version is within a specified version range.- Parameters:
args
- A list containing two strings: the version to check and the version range- Returns:
- true if the version is within the range, false otherwise
- Throws:
IllegalArgumentException
- if the number of arguments is not exactly two
-