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

tech.jhipster.lite.module.domain.replacement.OptionalReplacer Maven / Gradle / Ivy

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

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

public record OptionalReplacer(ElementReplacer replacer, String updatedValue) {
  public OptionalReplacer {
    Assert.notNull("replacer", replacer);
    Assert.notNull("updatedValue", updatedValue);
  }

  public String apply(String content) {
    if (replacer.dontNeedReplacement(content, updatedValue())) {
      return content;
    }

    return replacer().replacement().apply(content, updatedValue());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy