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

io.phasetwo.keycloak.themes.theme.FormatterFunction Maven / Gradle / Ivy

There is a newer version: 0.31
Show newest version
package io.phasetwo.keycloak.themes.theme;

import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.function.Function;
import lombok.extern.jbosslog.JBossLog;

@JBossLog
public abstract class FormatterFunction implements Function {

  protected final Properties rb;
  protected final Locale locale;
  protected final Map attributes;

  FormatterFunction(Properties rb, Locale locale, Map attributes) {
    this.rb = rb;
    this.locale = locale;
    this.attributes = attributes;
  }

  abstract String format(String input) throws Exception;

  @Override
  public String apply(String input) {
    try {
      return format(input);
    } catch (Exception e) {
      log.warn("error formatting for " + input, e);
    }
    return "";
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy