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

kz.greetgo.logging.structure.model.DestinationToFactory Maven / Gradle / Ivy

There is a newer version: 0.2.0
Show newest version
package kz.greetgo.logging.structure.model;

import kz.greetgo.logging.structure.parser.model.TopInstruction;

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

public class DestinationToFactory {
  private static final Map> map;

  static {
    map = new HashMap<>();
    map.put(Instr.ROLLING_FILE, DestinationToRollingFile::new);
    map.put(Instr.STDOUT, DestinationToStdout::new);
    map.put(Instr.STDERR, DestinationToStderr::new);
  }

  public static DestinationTo create(String type, String name, TopInstruction source) {
    var fab = map.get(type);
    return fab == null ? null : fab.apply(name, source);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy