/** * <p>Checks if the specified constructor is accessible.</p> * * <p>This simply ensures that the constructor is accessible.</p> * * @param <T> the constructor type * @param ctor the prototype constructor object, not {@code null} * @return the constructor, {@code null} if no matching accessible constructor found * @see java.lang.SecurityManager * @throws NullPointerException if {@code ctor} is {@code null} */ public static <T> Constructor<T> getAccessibleConstructor(final Constructor<T> ctor) { Validate.notNull(ctor, "constructor cannot be null"); return MemberUtils.isAccessible(ctor) && isAccessible(ctor.getDeclaringClass()) ? ctor : null; }
if (!MemberUtils.isAccessible(field)) { if (forceAccess) { field.setAccessible(true);
/** * <p>Returns an accessible method (that is, one that can be invoked via * reflection) that implements the specified Method. If no such method * can be found, return {@code null}.</p> * * @param method The method that we wish to call * @return The accessible method */ public static Method getAccessibleMethod(Method method) { if (!MemberUtils.isAccessible(method)) { return null; } // If the declaring class is public, we are done final Class<?> cls = method.getDeclaringClass(); if (Modifier.isPublic(cls.getModifiers())) { return method; } final String methodName = method.getName(); final Class<?>[] parameterTypes = method.getParameterTypes(); // Check the implemented interfaces and subinterfaces method = getAccessibleMethodFromInterfaceNest(cls, methodName, parameterTypes); // Check the superclass chain if (method == null) { method = getAccessibleMethodFromSuperclass(cls, methodName, parameterTypes); } return method; }
if (!ignoreAccess && !MemberUtils.isAccessible(method)) { return null;
/** * <p>Checks if the specified constructor is accessible.</p> * * <p>This simply ensures that the constructor is accessible.</p> * * @param <T> the constructor type * @param ctor the prototype constructor object, not {@code null} * @return the constructor, {@code null} if no matching accessible constructor found * @see java.lang.SecurityManager * @throws NullPointerException if {@code ctor} is {@code null} */ public static <T> Constructor<T> getAccessibleConstructor(final Constructor<T> ctor) { Validate.notNull(ctor, "constructor cannot be null"); return MemberUtils.isAccessible(ctor) && isAccessible(ctor.getDeclaringClass()) ? ctor : null; }
/** * <p>Checks if the specified constructor is accessible.</p> * * <p>This simply ensures that the constructor is accessible.</p> * * @param <T> the constructor type * @param ctor the prototype constructor object, not {@code null} * @return the constructor, {@code null} if no matching accessible constructor found * @see java.lang.SecurityManager * @throws NullPointerException if {@code ctor} is {@code null} */ public static <T> Constructor<T> getAccessibleConstructor(final Constructor<T> ctor) { Validate.notNull(ctor, "constructor cannot be null"); return MemberUtils.isAccessible(ctor) && isAccessible(ctor.getDeclaringClass()) ? ctor : null; }
/** * <p>Checks if the specified constructor is accessible.</p> * * <p>This simply ensures that the constructor is accessible.</p> * * @param <T> the constructor type * @param ctor the prototype constructor object, not {@code null} * @return the constructor, {@code null} if no matching accessible constructor found * @see java.lang.SecurityManager * @throws NullPointerException if {@code ctor} is {@code null} */ public static <T> Constructor<T> getAccessibleConstructor(final Constructor<T> ctor) { Validate.notNull(ctor, "constructor cannot be null"); return MemberUtils.isAccessible(ctor) && isAccessible(ctor.getDeclaringClass()) ? ctor : null; }
if (!MemberUtils.isAccessible(field)) { if (forceAccess) { field.setAccessible(true);
if (!MemberUtils.isAccessible(field)) { if (forceAccess) { field.setAccessible(true);
if (!MemberUtils.isAccessible(field)) { if (forceAccess) { field.setAccessible(true);
/** * <p>Returns an accessible method (that is, one that can be invoked via * reflection) that implements the specified Method. If no such method * can be found, return {@code null}.</p> * * @param method The method that we wish to call * @return The accessible method */ public static Method getAccessibleMethod(Method method) { if (!MemberUtils.isAccessible(method)) { return null; } // If the declaring class is public, we are done final Class<?> cls = method.getDeclaringClass(); if (Modifier.isPublic(cls.getModifiers())) { return method; } final String methodName = method.getName(); final Class<?>[] parameterTypes = method.getParameterTypes(); // Check the implemented interfaces and subinterfaces method = getAccessibleMethodFromInterfaceNest(cls, methodName, parameterTypes); // Check the superclass chain if (method == null) { method = getAccessibleMethodFromSuperclass(cls, methodName, parameterTypes); } return method; }
/** * <p>Returns an accessible method (that is, one that can be invoked via * reflection) that implements the specified Method. If no such method * can be found, return {@code null}.</p> * * @param method The method that we wish to call * @return The accessible method */ public static Method getAccessibleMethod(Method method) { if (!MemberUtils.isAccessible(method)) { return null; } // If the declaring class is public, we are done final Class<?> cls = method.getDeclaringClass(); if (Modifier.isPublic(cls.getModifiers())) { return method; } final String methodName = method.getName(); final Class<?>[] parameterTypes = method.getParameterTypes(); // Check the implemented interfaces and subinterfaces method = getAccessibleMethodFromInterfaceNest(cls, methodName, parameterTypes); // Check the superclass chain if (method == null) { method = getAccessibleMethodFromSuperclass(cls, methodName, parameterTypes); } return method; }
if (!ignoreAccess && !MemberUtils.isAccessible(method)) { return null;
/** * <p>Returns an accessible method (that is, one that can be invoked via * reflection) that implements the specified Method. If no such method * can be found, return {@code null}.</p> * * @param method The method that we wish to call * @return The accessible method */ public static Method getAccessibleMethod(Method method) { if (!MemberUtils.isAccessible(method)) { return null; } // If the declaring class is public, we are done final Class<?> cls = method.getDeclaringClass(); if (Modifier.isPublic(cls.getModifiers())) { return method; } final String methodName = method.getName(); final Class<?>[] parameterTypes = method.getParameterTypes(); // Check the implemented interfaces and subinterfaces method = getAccessibleMethodFromInterfaceNest(cls, methodName, parameterTypes); // Check the superclass chain if (method == null) { method = getAccessibleMethodFromSuperclass(cls, methodName, parameterTypes); } return method; }
if (!ignoreAccess && !MemberUtils.isAccessible(method)) { return null;
if (!ignoreAccess && !MemberUtils.isAccessible(method)) { return null;