public static MethodException[] getMethodExceptions(Class<?> clazz, String methodName, Class<?>... parameterTypes) { return getMethodExceptions(clazz, getMethod(clazz, methodName, parameterTypes)); }
public static MethodParameter[] getMethodParameters(Class<?> clazz, String methodName, Class<?>... parameterTypes) { return getMethodParameters(clazz, getMethod(clazz, methodName, parameterTypes)); }
public static Class<?>[] getMethodParameterTypes(Class<?> clazz, String methodName, Class<?>... parameterTypes) { Method m = getMethod(clazz, methodName, parameterTypes); if (m == null) { return null; } return m.getParameterTypes(); }
public static Class<?>[] getMethodExceptionTypes(Class<?> clazz, String methodName, Class<?>... parameterTypes) { Method m = getMethod(clazz, methodName, parameterTypes); if (m == null) { return null; } return m.getExceptionTypes(); }
/** * Returns the return type of a method if it exists within the class. * Calling this method is equal to calling {@link ReflectionUtils#getMethod(Class, String, Class[])} with * a null check and finally return the type via getReturnType(). * * @param clazz The class within to look for the method with the given method * name * @param methodName The name of the method to be returned * @param parameterTypes The accepting parameter types of the method * @return The return type of the method if it can be found, otherwise null * @see ReflectionUtils#getMethod(Class, String, Class[]) */ public static Class<?> getMethodReturnType(Class<?> clazz, String methodName, Class<?>... parameterTypes) { Method m = getMethod(clazz, methodName, parameterTypes); if (m == null) { return null; } return m.getReturnType(); }
public static Class<?>[] getResolvedMethodExceptionTypes(Class<?> clazz, String methodName, Class<?>... parameterTypes) { return getResolvedMethodExceptionTypes(clazz, getMethod(clazz, methodName, parameterTypes)); }
public static Class<?>[] getResolvedMethodParameterTypes(Class<?> clazz, String methodName, Class<?>... parameterTypes) { return getResolvedMethodParameterTypes(clazz, getMethod(clazz, methodName, parameterTypes)); }
public static Class<?> getResolvedMethodReturnType(Class<?> clazz, String methodName, Class<?>... parameterTypes) { return getResolvedMethodReturnType(clazz, getMethod(clazz, methodName, parameterTypes)); }
public static Class<?>[] getResolvedMethodReturnTypeArguments(Class<?> clazz, String methodName, Class<?>... parameterTypes) { return getResolvedMethodReturnTypeArguments(clazz, getMethod(clazz, methodName, parameterTypes)); }
public static Class<?>[][] getResolvedMethodParameterTypesArguments(Class<?> clazz, String methodName, Class<?>... parameterTypes) { return getResolvedMethodParameterTypesArguments(clazz, getMethod(clazz, methodName, parameterTypes)); }
public Hibernate5TransactionSynchronizationStrategy(EntityManager em) { try { this.tx = em.getTransaction(); } catch (IllegalStateException e) { throw new IllegalStateException("Could not access entity transaction!", e); } try { Object s = em.unwrap(Class.forName("org.hibernate.Session")); this.synchronizationRegistry = ExpressionUtils.getNullSafeValue(s, "transactionCoordinator.localSynchronizations"); this.registerSynchronization = ReflectionUtils.getMethod(synchronizationRegistry.getClass(), "registerSynchronization", Synchronization.class); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
public Hibernate4TransactionSynchronizationStrategy(EntityManager em) { try { this.tx = em.getTransaction(); } catch (IllegalStateException e) { throw new IllegalStateException("Could not access entity transaction!", e); } try { Object s = em.unwrap(Class.forName("org.hibernate.Session")); this.synchronizationRegistry = ExpressionUtils.getNullSafeValue(s, "transactionCoordinator.synchronizationRegistry"); this.registerSynchronization = ReflectionUtils.getMethod(synchronizationRegistry.getClass(), "registerSynchronization", Synchronization.class); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }