public class DumpMethods { try { serialEventMethod = parent.getClass().getMethod("serialEvent", new Class[] { Serial.class }); } catch (Exception e) { // no such method, or an error.. which is fine, just ignore }