@Deprecated(since="9")
public boolean isAccessible()
Get the value of the
accessible
flag for this reflected object.
Deprecated.
This method is deprecated because its name hints that it checks if the reflected object is accessible when it actually indicates if the checks for Java language access control are suppressed. This method may return false on a reflected object that is accessible to the caller. To test if this reflected object is accessible, it should use canAccess(Object).
Examples
package com.logicbig.example.method;
import java.lang.reflect.Method;
public class IsAccessibleExample { private static class Test { private void process() { } }
public static void main(String... args) throws NoSuchMethodException { Method m = Test.class.getDeclaredMethod("process"); boolean accessible = m.isAccessible(); System.out.println(accessible); } }