private Object getArgument(Argument arg) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { Class<?> argClass = Class.forName(arg.getType()); Constructor<?> construct = argClass.getConstructor(new Class[] { String.class }); Map<String,String> mdc = Logging.getCopyOfContextMap(); try { return construct.newInstance(new Object[] { arg.getValue().orElse(null) }); } finally { Logging.setContextMap(mdc); } }