private static boolean isValidInterceptorClassLifecycleInterceptorMethod(InterceptionType interceptionType, Method method) { if (!Object.class.equals(method.getReturnType()) && !Void.TYPE.equals(method.getReturnType())) { throw ValidatorLogger.LOG.interceptorMethodDoesNotReturnObjectOrVoid(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), Void.TYPE.getName(), OBJECT_CLASS_NAME, Formats.formatAsStackTraceElement(method)); } Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length == 0) { return false; } else if (parameterTypes.length == 1) { if (InvocationContext.class.isAssignableFrom(parameterTypes[0])) { return true; } throw ValidatorLogger.LOG.interceptorMethodDoesNotHaveCorrectTypeOfParameter(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), InvocationContext.class.getName(), Formats.formatAsStackTraceElement(method)); } else { throw ValidatorLogger.LOG.interceptorMethodDoesNotHaveExactlyOneParameter(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), Formats.formatAsStackTraceElement(method)); } }
private static boolean isValidInterceptorClassLifecycleInterceptorMethod(InterceptionType interceptionType, Method method) { if (!Object.class.equals(method.getReturnType()) && !Void.TYPE.equals(method.getReturnType())) { throw ValidatorLogger.LOG.interceptorMethodDoesNotReturnObjectOrVoid(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), Void.TYPE.getName(), OBJECT_CLASS_NAME, Formats.formatAsStackTraceElement(method)); } Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length == 0) { return false; } else if (parameterTypes.length == 1) { if (InvocationContext.class.isAssignableFrom(parameterTypes[0])) { return true; } throw ValidatorLogger.LOG.interceptorMethodDoesNotHaveCorrectTypeOfParameter(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), InvocationContext.class.getName(), Formats.formatAsStackTraceElement(method)); } else { throw ValidatorLogger.LOG.interceptorMethodDoesNotHaveExactlyOneParameter(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), Formats.formatAsStackTraceElement(method)); } }
private static boolean isValidInterceptorClassLifecycleInterceptorMethod(InterceptionType interceptionType, Method method) { if (!Object.class.equals(method.getReturnType()) && !Void.TYPE.equals(method.getReturnType())) { throw ValidatorLogger.LOG.interceptorMethodDoesNotReturnObjectOrVoid(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), Void.TYPE.getName(), OBJECT_CLASS_NAME, Formats.formatAsStackTraceElement(method)); } Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length == 0) { return false; } else if (parameterTypes.length == 1) { if (InvocationContext.class.isAssignableFrom(parameterTypes[0])) { return true; } throw ValidatorLogger.LOG.interceptorMethodDoesNotHaveCorrectTypeOfParameter(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), InvocationContext.class.getName(), Formats.formatAsStackTraceElement(method)); } else { throw ValidatorLogger.LOG.interceptorMethodDoesNotHaveExactlyOneParameter(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), Formats.formatAsStackTraceElement(method)); } }
private static boolean isValidInterceptorClassLifecycleInterceptorMethod(InterceptionType interceptionType, Method method) { if (!Object.class.equals(method.getReturnType()) && !Void.TYPE.equals(method.getReturnType())) { throw ValidatorLogger.LOG.interceptorMethodDoesNotReturnObjectOrVoid(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), Void.TYPE.getName(), OBJECT_CLASS_NAME, Formats.formatAsStackTraceElement(method)); } Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length == 0) { return false; } else if (parameterTypes.length == 1) { if (InvocationContext.class.isAssignableFrom(parameterTypes[0])) { return true; } throw ValidatorLogger.LOG.interceptorMethodDoesNotHaveCorrectTypeOfParameter(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), InvocationContext.class.getName(), Formats.formatAsStackTraceElement(method)); } else { throw ValidatorLogger.LOG.interceptorMethodDoesNotHaveExactlyOneParameter(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), Formats.formatAsStackTraceElement(method)); } }
private static boolean isValidInterceptorClassLifecycleInterceptorMethod(InterceptionType interceptionType, Method method) { if (!Object.class.equals(method.getReturnType()) && !Void.TYPE.equals(method.getReturnType())) { throw ValidatorLogger.LOG.interceptorMethodDoesNotReturnObjectOrVoid(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), Void.TYPE.getName(), OBJECT_CLASS_NAME, Formats.formatAsStackTraceElement(method)); } Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length == 0) { return false; } else if (parameterTypes.length == 1) { if (InvocationContext.class.isAssignableFrom(parameterTypes[0])) { return true; } throw ValidatorLogger.LOG.interceptorMethodDoesNotHaveCorrectTypeOfParameter(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), InvocationContext.class.getName(), Formats.formatAsStackTraceElement(method)); } else { throw ValidatorLogger.LOG.interceptorMethodDoesNotHaveExactlyOneParameter(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), Formats.formatAsStackTraceElement(method)); } }
private static boolean isValidInterceptorClassLifecycleInterceptorMethod(InterceptionType interceptionType, Method method) { if (!Object.class.equals(method.getReturnType()) && !Void.TYPE.equals(method.getReturnType())) { throw ValidatorLogger.LOG.interceptorMethodDoesNotReturnObjectOrVoid(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), Void.TYPE.getName(), OBJECT_CLASS_NAME, Formats.formatAsStackTraceElement(method)); } Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length == 0) { return false; } else if (parameterTypes.length == 1) { if (InvocationContext.class.isAssignableFrom(parameterTypes[0])) { return true; } throw ValidatorLogger.LOG.interceptorMethodDoesNotHaveCorrectTypeOfParameter(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), InvocationContext.class.getName(), Formats.formatAsStackTraceElement(method)); } else { throw ValidatorLogger.LOG.interceptorMethodDoesNotHaveExactlyOneParameter(method.getName(), method.getDeclaringClass().getName(), interceptionType.annotationClassName(), Formats.formatAsStackTraceElement(method)); } }