/** * Get a list of all methods which the given class declares, implements, * overrides or inherits. Methods are added by adding first all methods of * the class itself and its implemented interfaces, then the super class and * its interfaces, etc. * * @param clazz the class for which to retrieve the methods * * @return set of all methods of the given class */ public static List<Method> getAllMethods(Class<?> clazz) { Contracts.assertNotNull( clazz ); List<Method> methods = newArrayList(); for ( Class<?> hierarchyClass : ClassHierarchyHelper.getHierarchy( clazz ) ) { Collections.addAll( methods, run( GetMethods.action( hierarchyClass ) ) ); } return methods; }
private <T> DefaultGroupSequenceProvider<? super T> newGroupSequenceProviderClassInstance(Class<T> beanClass, Class<? extends DefaultGroupSequenceProvider<? super T>> providerClass) { Method[] providerMethods = run( GetMethods.action( providerClass ) ); for ( Method method : providerMethods ) { Class<?>[] paramTypes = method.getParameterTypes(); if ( "getValidationGroups".equals( method.getName() ) && !method.isBridge() && paramTypes.length == 1 && paramTypes[0].isAssignableFrom( beanClass ) ) { return run( NewInstance.action( providerClass, "the default group sequence provider" ) ); } } throw LOG.getWrongDefaultGroupSequenceProviderTypeException( beanClass ); }
private <T> DefaultGroupSequenceProvider<? super T> newGroupSequenceProviderClassInstance(Class<T> beanClass, Class<? extends DefaultGroupSequenceProvider<? super T>> providerClass) { Method[] providerMethods = run( GetMethods.action( providerClass ) ); for ( Method method : providerMethods ) { Class<?>[] paramTypes = method.getParameterTypes(); if ( "getValidationGroups".equals( method.getName() ) && !method.isBridge() && paramTypes.length == 1 && paramTypes[0].isAssignableFrom( beanClass ) ) { return run( NewInstance.action( providerClass, "the default group sequence provider" ) ); } } throw log.getWrongDefaultGroupSequenceProviderTypeException( beanClass ); }
/** * Get a list of all methods which the given class declares, implements, * overrides or inherits. Methods are added by adding first all methods of * the class itself and its implemented interfaces, then the super class and * its interfaces, etc. * * @param clazz the class for which to retrieve the methods * * @return set of all methods of the given class */ public static List<Method> getAllMethods(Class<?> clazz) { Contracts.assertNotNull( clazz ); List<Method> methods = newArrayList(); for ( Class<?> hierarchyClass : ClassHierarchyHelper.getHierarchy( clazz ) ) { Collections.addAll( methods, run( GetMethods.action( hierarchyClass ) ) ); } return methods; }