28
28
import org .apache .maven .api .model .Activation ;
29
29
import org .apache .maven .api .model .Profile ;
30
30
import org .apache .maven .api .services .BuilderProblem .Severity ;
31
+ import org .apache .maven .api .services .Interpolator ;
31
32
import org .apache .maven .api .services .ModelProblem .Version ;
32
33
import org .apache .maven .api .services .ModelProblemCollector ;
33
34
import org .apache .maven .api .services .VersionParser ;
34
35
import org .apache .maven .api .services .model .ProfileActivationContext ;
35
36
import org .apache .maven .api .services .model .ProfileActivator ;
36
- import org .apache .maven .internal .impl .model .DefaultInterpolator ;
37
37
38
38
import static org .apache .maven .internal .impl .model .profile .ConditionParser .toBoolean ;
39
39
@@ -47,14 +47,18 @@ public class ConditionProfileActivator implements ProfileActivator {
47
47
48
48
private final VersionParser versionParser ;
49
49
50
+ private final Interpolator interpolator ;
51
+
50
52
/**
51
53
* Constructs a new ConditionProfileActivator with the necessary dependencies.
52
54
*
53
55
* @param versionParser The parser for handling version comparisons
56
+ * @param interpolator The interpolator for interpolating the values in the given map using the provided callback function
54
57
*/
55
58
@ Inject
56
- public ConditionProfileActivator (VersionParser versionParser ) {
59
+ public ConditionProfileActivator (VersionParser versionParser , Interpolator interpolator ) {
57
60
this .versionParser = versionParser ;
61
+ this .interpolator = interpolator ;
58
62
}
59
63
60
64
/**
@@ -106,7 +110,7 @@ public boolean presentInConfig(Profile profile, ProfileActivationContext context
106
110
* @param versionParser The parser for handling version comparisons
107
111
* @return A map of function names to their implementations
108
112
*/
109
- public static Map <String , ConditionParser .ExpressionFunction > registerFunctions (
113
+ public Map <String , ConditionParser .ExpressionFunction > registerFunctions (
110
114
ProfileActivationContext context , VersionParser versionParser ) {
111
115
Map <String , ConditionParser .ExpressionFunction > functions = new HashMap <>();
112
116
@@ -156,9 +160,9 @@ public static Map<String, ConditionParser.ExpressionFunction> registerFunctions(
156
160
* @return The value of the property, or null if not found
157
161
* @throws IllegalArgumentException if the number of arguments is not exactly one
158
162
*/
159
- static String property (ProfileActivationContext context , String name ) {
163
+ String property (ProfileActivationContext context , String name ) {
160
164
String value = doGetProperty (context , name );
161
- return new DefaultInterpolator () .interpolate (value , s -> doGetProperty (context , s ));
165
+ return interpolator .interpolate (value , s -> doGetProperty (context , s ));
162
166
}
163
167
164
168
static String doGetProperty (ProfileActivationContext context , String name ) {
0 commit comments