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

devonfw / IDEasy / 13788808942

11 Mar 2025 01:08PM UTC coverage: 66.998% (-1.6%) from 68.619%
13788808942

Pull #1017

github

web-flow
Merge 2597874a1 into 2cf68279f
Pull Request #1017: #404: enhance logging with custom slf4j bridge

3034 of 4951 branches covered (61.28%)

Branch coverage included in aggregate %.

7831 of 11266 relevant lines covered (69.51%)

3.03 hits per line

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

65.0
cli/src/main/java/com/devonfw/tools/ide/url/model/file/AbstractUrlFile.java
1
package com.devonfw.tools.ide.url.model.file;
2

3
import java.nio.file.Files;
4

5
import org.jline.utils.Log;
6

7
import com.devonfw.tools.ide.url.model.AbstractUrlArtifactWithParent;
8
import com.devonfw.tools.ide.url.model.folder.AbstractUrlFolder;
9
import com.devonfw.tools.ide.url.model.folder.UrlFolder;
10

11
/**
12
 * Abstract base implementation of {@link UrlFile}.
13
 *
14
 * @param <P> type of the {@link #getParent() parent} {@link UrlFolder folder}.
15
 */
16
public abstract class AbstractUrlFile<P extends AbstractUrlFolder<?>> extends AbstractUrlArtifactWithParent<P>
17
    implements UrlFile<P> {
18

19
  /**
20
   * {@code true} if modified and changes are unsaved, {@code false} otherwise.
21
   */
22
  protected boolean modified;
23

24
  /**
25
   * The constructor.
26
   *
27
   * @param parent the {@link #getParent() parent folder}.
28
   * @param name the {@link #getName() filename}.
29
   */
30
  public AbstractUrlFile(P parent, String name) {
31

32
    super(parent, name);
4✔
33
    this.modified = true;
3✔
34
  }
1✔
35

36
  @Override
37
  public void load(boolean recursive) {
38

39
    if (!this.loaded) {
3✔
40
      if (Files.exists(getPath())) {
6✔
41
        doLoad();
2✔
42
      }
43
      this.loaded = true;
3✔
44
      this.modified = false;
3✔
45
    }
46
  }
1✔
47

48
  /**
49
   * Performs the actual loading.
50
   *
51
   * @see #load(boolean)
52
   */
53
  protected abstract void doLoad();
54

55
  @Override
56
  public void save() {
57

58
    if (this.modified) {
×
59
      Log.debug("Saving {}", getPath());
×
60
      doSave();
×
61
      this.modified = false;
×
62
    }
63
  }
×
64

65
  /**
66
   * Performs the actual saving.
67
   *
68
   * @see #save()
69
   */
70
  protected abstract void doSave();
71

72
}
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

© 2025 Coveralls, Inc