Class ConditionParser
java.lang.Object
org.apache.maven.impl.model.profile.ConditionParser
The 
ConditionParser class is responsible for parsing and evaluating expressions.
 It supports tokenizing the input expression and resolving custom functions passed in a map.
 This class implements a recursive descent parser to handle various operations including
 arithmetic, logical, and comparison operations, as well as function calls.- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfaceA functional interface that represents an expression function to be applied to a list of arguments.
- 
Constructor SummaryConstructorsConstructorDescriptionConditionParser(Map<String, ConditionParser.ExpressionFunction> functions, UnaryOperator<String> propertyResolver) Constructs a newConditionParserwith the given function mappings.
- 
Method SummaryModifier and TypeMethodDescriptionParses the given expression and returns the result of the evaluation.static BooleanConverts an object to a boolean value.static doubleConverts an object to a double value.static intConverts an object to an integer value.static StringConverts an object to a string representation.
- 
Constructor Details- 
ConditionParserpublic ConditionParser(Map<String, ConditionParser.ExpressionFunction> functions, UnaryOperator<String> propertyResolver) Constructs a newConditionParserwith the given function mappings.- Parameters:
- functions- a map of function names to their corresponding- ExpressionFunctionimplementations
- propertyResolver- the property resolver
 
 
- 
- 
Method Details- 
parse
- 
toStringConverts an object to a string representation. If the object is aDouble, it formats it without any decimal places. Otherwise, it uses theString.valueOfmethod.- Parameters:
- value- the object to convert to a string
- Returns:
- the string representation of the object
 
- 
toBooleanConverts an object to a boolean value. If the object is: - aBoolean, returns its value directly. - aString, returnstrueif the string is non-blank. - aNumber, returnstrueif its integer value is not zero. For other object types, returnstrueif the object is non-null.- Parameters:
- value- the object to convert to a boolean
- Returns:
- the boolean representation of the object
 
- 
toDoubleConverts an object to a double value. If the object is: - aNumber, returns its double value. - aString, tries to parse it as a double. - aBoolean, returns1.0fortrue,0.0forfalse. If the object cannot be converted, aRuntimeExceptionis thrown.- Parameters:
- value- the object to convert to a double
- Returns:
- the double representation of the object
- Throws:
- RuntimeException- if the object cannot be converted to a double
 
- 
toIntConverts an object to an integer value. If the object is: - aNumber, returns its integer value. - aString, tries to parse it as an integer, or as a double then converted to an integer. - aBoolean, returns1fortrue,0forfalse. If the object cannot be converted, aRuntimeExceptionis thrown.- Parameters:
- value- the object to convert to an integer
- Returns:
- the integer representation of the object
- Throws:
- RuntimeException- if the object cannot be converted to an integer
 
 
-