public static RestMethodWrapper get(final Object pOwner, final Method pMethod) { // Make it work with private methods and pMethod.setAccessible(true); if (HasMethodHandleHelper.HASHANDLES && (!"1.7".equals("java.specification.version"))) { return new Java8RestMethodWrapper(pOwner, pMethod); } else { return new Java6RestMethodWrapper(pOwner, pMethod); } }
public Java8RestMethodWrapper(Object pOwner, Method pMethod) { super(pOwner, pMethod); try { mMethodHandle = MethodHandles.lookup().unreflect(pMethod).bindTo(pOwner); mParameterAnnotations = pMethod.getParameterAnnotations(); mElementWrapper = pMethod.getAnnotation(XmlElementWrapper.class); mGenericReturnType = pMethod.getGenericReturnType(); mReturnType = pMethod.getReturnType(); mRestMethod = pMethod.getAnnotation(RestMethod.class); mDeclaringClass = pMethod.getDeclaringClass(); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }