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

im.aop.loggers.messageinterpolation.StringSupplierLookup Maven / Gradle / Ivy

Go to download

A handy and configurable sets of annotation-based loggers for Spring Boot that can log every execution of a method when entering or exiting normally or abnormally, without you writing a single line of code using aspect-oriented programming (AOP)

The newest version!
package im.aop.loggers.messageinterpolation;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;

/**
 * Default {@link StringLookup} used by {@link StringSubstitutor} to lookup for String value by
 * key.
 *
 * @author Andy Lian
 */
public class StringSupplierLookup implements StringLookup {

  private final Map> map = new HashMap<>();

  @Override
  public String lookup(final String key) {
    return map.containsKey(key) ? map.get(key).get() : null;
  }

  public void addStringSupplier(final String key, final Supplier stringSupplier) {
    map.put(key, stringSupplier);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy