<p><pre><code> class ObjectUtil {
static boolean hasMethod(Object obj, String... methodNames) {
for(String methodName : methodNames)
if(!hasMethod(obj, methodName))
return false;
return true;
}
static boolean hasMethod(Object obj, String methodName) {
for(Method method : obj.getClass().getMethods())
if(method.getName().equals(methodName))
return true;
return false;
}
}</code></pre>