private static boolean isMethodValid(Method method) {
        return method != null && Modifier.isPublic(method.getModifiers())
                && method.getParameterTypes().length == 0
                && !method.getReturnType().equals(Void.TYPE)
                && !Object.class.equals(method.getDeclaringClass());
    }
private static boolean isMethodValid(Method method) {
        return method != null && Modifier.isPublic(method.getModifiers())
                && method.getParameterTypes().length == 0
                && !method.getReturnType().equals(Void.TYPE)
                && !Object.class.equals(method.getDeclaringClass());
    }
private static boolean isMethodValid ( Method method ) { return method != null && Modifier . isPublic ( method . getModifiers ( ) ) && method . getParameterTypes ( ) . length == 0 && ! method . getReturnType ( ) . equals ( Void . TYPE ) && ! Object . class . equals ( method . getDeclaringClass ( ) ) ; }
A valid method:
<ul>
<li>is public</li>
<li>has no parameters</li>
<li>has non-void return type</li>
<li>its declaring class is not {@link Object}</li>
</ul>

@param method
@return <code>true</code> if the given method is considered a read method
A valid method : <ul > <li > is public< / li > <li > has no parameters< / li > <li > has non - void return type< / li > <li > its declaring class is not { @link Object } < / li > < / ul >