• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 42916857669

10 Nov 2026 10:41PM UTC coverage: 75.192% (-0.06%) from 75.25%
42916857669

push

github

web-flow
#2409: implemented advanced approach for expression functions (#2775)

6330 of 9333 branches covered (67.82%)

Branch coverage included in aggregate %.

16244 of 20689 relevant lines covered (78.52%)

3.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.86
cli/src/main/java/com/devonfw/tools/ide/variable/VariableSyntax.java
1
package com.devonfw.tools.ide.variable;
2

3
import java.util.regex.Matcher;
4
import java.util.regex.Pattern;
5

6
/**
7
 * Enum with the available syntax for variables.
8
 *
9
 * @see com.devonfw.tools.ide.environment.EnvironmentVariables#resolve(String, Object, boolean)
10
 */
11
public enum VariableSyntax {
3 ✔
12

13
  /**
14
   * Syntax using curly braces ("${...}"). Considered legacy in IDEasy and only supported for devonfw-ide backward compatibility.
15
   *
16
   * @see IdeVariables#IDE_VARIABLE_SYNTAX_LEGACY_SUPPORT_ENABLED
17
   */
18
  CURLY('{', '}'),
8 ✔
19

20
  /**
21
   * Syntax using square brackets ("$[...]").
22
   */
23
  SQUARE('[', ']');
8 ✔
24

25
  private final Pattern pattern;
26

27
  private final char open;
28

29
  private final char close;
30

31
  VariableSyntax(char open, char close) {
4 ✔
32

33
    String regex = "\\$\\" + open + "([a-zA-Z0-9_-]+)\\" + close;
4 ✔
34
    this.pattern = Pattern.compile(regex);
4 ✔
35
    this.open = open;
3 ✔
36
    this.close = close;
3 ✔
37
  }
1 ✔
38

39
  /**
40
   * @return the regular expression {@link Pattern} for this {@link VariableSyntax}.
41
   */
42
  public Pattern getPattern() {
43

44
    return this.pattern;
3 ✔
45
  }
46

47
  /**
48
   * @return the opening character.
49
   */
50
  public char getOpen() {
51

52
    return open;
×
53
  }
54

55
  /**
56
   * @return the closing character.
57
   */
58
  public char getClose() {
59

60
    return close;
3 ✔
61
  }
62

63
  /**
64
   * @param matcher the current {@link Matcher}.
65
   * @return the variable name.
66
   */
67
  public String getVariable(Matcher matcher) {
68
    return matcher.group(1);
4 ✔
69
  }
70

71
  /**
72
   * @param variableName the variable name.
73
   * @return the variable syntax for the given {@code variableName}. E.g. for {@link #CURLY} and the given {@link String} "JAVA_HOME" this method would return
74
   *     "${JAVA_HOME}".
75
   */
76
  public String create(String variableName) {
77

78
    return "$" + this.open + variableName + this.close;
7 ✔
79
  }
80

81
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc