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

devonfw / IDEasy / 22300285724

23 Feb 2026 09:32AM UTC coverage: 70.754% (+0.3%) from 70.474%
22300285724

Pull #1714

github

web-flow
Merge caa980897 into 379acdc9d
Pull Request #1714: #404: #1713: advanced logging

4064 of 6348 branches covered (64.02%)

Branch coverage included in aggregate %.

10640 of 14434 relevant lines covered (73.71%)

3.1 hits per line

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

42.86
cli/src/main/java/com/devonfw/tools/ide/variable/VariableDefinitionBoolean.java
1
package com.devonfw.tools.ide.variable;
2

3
import java.util.Locale;
4
import java.util.function.Function;
5

6
import org.slf4j.Logger;
7
import org.slf4j.LoggerFactory;
8

9
import com.devonfw.tools.ide.context.IdeContext;
10

11
/**
12
 * Implementation of {@link VariableDefinition} for a variable with the {@link #getValueType() value type} {@link Boolean}.
13
 */
14
public class VariableDefinitionBoolean extends AbstractVariableDefinition<Boolean> {
15

16
  private static final Logger LOG = LoggerFactory.getLogger(VariableDefinitionBoolean.class);
4✔
17

18
  /**
19
   * The constructor.
20
   *
21
   * @param name the {@link #getName() variable name}.
22
   */
23
  public VariableDefinitionBoolean(String name) {
24

25
    super(name);
×
26
  }
×
27

28
  /**
29
   * The constructor.
30
   *
31
   * @param name the {@link #getName() variable name}.
32
   * @param legacyName the {@link #getLegacyName() legacy name}.
33
   */
34
  public VariableDefinitionBoolean(String name, String legacyName) {
35

36
    super(name, legacyName);
×
37
  }
×
38

39
  /**
40
   * The constructor.
41
   *
42
   * @param name the {@link #getName() variable name}.
43
   * @param legacyName the {@link #getLegacyName() legacy name}.
44
   * @param defaultValueFactory the factory {@link Function} for the {@link #getDefaultValue(IdeContext) default value}.
45
   */
46
  public VariableDefinitionBoolean(String name, String legacyName, Function<IdeContext, Boolean> defaultValueFactory) {
47

48
    super(name, legacyName, defaultValueFactory);
5✔
49
  }
1✔
50

51
  /**
52
   * The constructor.
53
   *
54
   * @param name the {@link #getName() variable name}.
55
   * @param legacyName the {@link #getLegacyName() legacy name}.
56
   * @param defaultValueFactory the factory {@link Function} for the {@link #getDefaultValue(IdeContext) default value}.
57
   * @param forceDefaultValue the {@link #isForceDefaultValue() forceDefaultValue} flag.
58
   */
59
  public VariableDefinitionBoolean(String name, String legacyName, Function<IdeContext, Boolean> defaultValueFactory, boolean forceDefaultValue) {
60

61
    super(name, legacyName, defaultValueFactory, forceDefaultValue);
×
62
  }
×
63

64
  /**
65
   * The constructor.
66
   *
67
   * @param name the {@link #getName() variable name}.
68
   * @param legacyName the {@link #getLegacyName() legacy name}.
69
   * @param defaultValueFactory the factory {@link Function} for the {@link #getDefaultValue(IdeContext) default value}.
70
   * @param forceDefaultValue the {@link #isForceDefaultValue() forceDefaultValue} flag.
71
   * @param export the {@link #isExport() export} flag.
72
   */
73
  public VariableDefinitionBoolean(String name, String legacyName, Function<IdeContext, Boolean> defaultValueFactory, boolean forceDefaultValue,
74
      boolean export) {
75

76
    super(name, legacyName, defaultValueFactory, forceDefaultValue, export);
×
77
  }
×
78

79
  @Override
80
  public Class<Boolean> getValueType() {
81

82
    return Boolean.class;
×
83
  }
84

85
  @Override
86
  public Boolean fromString(String value, IdeContext context) {
87

88
    String lower = value.trim().toLowerCase(Locale.ROOT);
5✔
89
    return switch (lower) {
9!
90
      case "true", "yes" -> Boolean.TRUE;
2✔
91
      case "false", "no" -> Boolean.FALSE;
2✔
92
      default -> {
93
        LOG.warn("Variable {} has invalid boolean value {} - using false as fallback", getName(), value);
×
94
        yield Boolean.FALSE;
×
95
      }
96
    };
97
  }
98

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

© 2026 Coveralls, Inc