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

io.github.qsy7.logging.util.SensitiveUtil Maven / Gradle / Ivy

The newest version!
// Generated by delombok at Fri Apr 08 14:43:06 EDT 2022
package io.github.qsy7.logging.util;

public class SensitiveUtil {
  // TODO: do not hard-code this and do not depend on external libraries
  public static final int OUTPUT_LENGTH = 80;
  // TODO: do not hard-code this and do not depend on external libraries
  public static final int SENSITIVE_LAST_CHARACTERS_TO_DISPLAY = 4;

  public static String format(final String input, final boolean isSensitive) {
    if (!isSensitive) {
      return input;
    }
    if (input == null || input.length() == 0) {
      return input;
    }
    if (input.length() < SENSITIVE_LAST_CHARACTERS_TO_DISPLAY) {
      return "";
    }
    return input.substring(input.length() - SENSITIVE_LAST_CHARACTERS_TO_DISPLAY);
  }

  @java.lang.SuppressWarnings("all")
  private SensitiveUtil() {
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy