public static Notification read(NodeInfo from, Boss.Reader r) throws IOException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { int code = r.readInt(); Class<? extends Notification> nclass = classes.get(code); if( nclass != null ) { Constructor c = nclass.getDeclaredConstructor(); c.setAccessible(true); Notification n = (Notification) c.newInstance(); n.readFrom(r); n.from = from; return n; } else { System.out.println("*** unknown notification class code: "+code); return null; } }