All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.jhipster.lite.module.domain.gitignore.GitIgnoreEntry Maven / Gradle / Ivy

There is a newer version: 1.22.0
Show newest version
package tech.jhipster.lite.module.domain.gitignore;

import tech.jhipster.lite.shared.error.domain.Assert;

public sealed interface GitIgnoreEntry {
  String get();

  record GitIgnorePattern(String value) implements GitIgnoreEntry {
    public GitIgnorePattern {
      Assert.notBlank("value", value);
    }

    public String get() {
      return value;
    }

    @Override
    public String toString() {
      return value;
    }
  }

  record GitIgnoreComment(String value) implements GitIgnoreEntry {
    private static final String COMMENT_PREFIX = "#";

    public GitIgnoreComment(String value) {
      Assert.notBlank("value", value);
      this.value = value.startsWith(COMMENT_PREFIX) ? value : COMMENT_PREFIX + " " + value;
    }

    public String get() {
      return value;
    }

    @Override
    public String toString() {
      return value;
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy