SHARE
TWEET

Untitled

a guest May 21st, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class LoggerFactory {
  2.     private static final Map<String, Class<? extends LoggingOperation>> instances = new HashMap<>();
  3.  
  4.     public static void register(String loggerMedium, Class<? extends LoggingOperation> instance) {
  5.         if (loggerMedium != null && instance != null) {
  6.             instances.put(loggerMedium, instance);
  7.         }
  8.     }
  9.  
  10.     public static LoggingOperation getInstance(ApplicationContext context, String loggerMedium) {
  11.         if (instances.containsKey(loggerMedium)) {
  12.             return context.getBean(instances.get(loggerMedium));
  13.         }
  14.         return null;
  15.     }
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top