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

devonfw / IDEasy / 13858963404

14 Mar 2025 02:38PM UTC coverage: 67.657% (-1.0%) from 68.619%
13858963404

push

github

web-flow
#1024: Move urls into url-updater module (#1025)

Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>

3036 of 4915 branches covered (61.77%)

Branch coverage included in aggregate %.

7825 of 11138 relevant lines covered (70.25%)

3.07 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