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

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

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

import java.util.regex.Pattern;

public interface ReplacementCondition {
  boolean needReplacement(String contentBeforeReplacement, String replacement);

  static ReplacementCondition always() {
    return (contentBeforeReplacement, replacement) -> true;
  }

  static ReplacementCondition notContainingReplacement() {
    return (contentBeforeReplacement, replacement) -> !contentBeforeReplacement.contains(replacement);
  }

  static ReplacementCondition notContaining(String text) {
    return (contentBeforeReplacement, replacement) -> !contentBeforeReplacement.contains(text);
  }

  static ReplacementCondition notMatchingRegex(Pattern pattern) {
    return (contentBeforeReplacement, replacement) -> pattern.matcher(contentBeforeReplacement).find();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy