Package org.springframework.util.ReflectionUtils

Examples of org.springframework.util.ReflectionUtils.MethodCallback


    }

    if (clazz.isInterface()) {
      final List<Method> methods = new ArrayList<Method>();

      ReflectionUtils.doWithMethods(clazz, new MethodCallback() {
        @Override
        public void doWith(Method method) throws IllegalArgumentException,
            IllegalAccessException {
          methods.add(method);
        }
View Full Code Here


  private MethodInvocationRecoverer<?> getRecoverer(Object target, Method method) {
    if (target instanceof MethodInvocationRecoverer) {
      return (MethodInvocationRecoverer<?>) target;
    }
    final AtomicBoolean foundRecoverable = new AtomicBoolean(false);
    ReflectionUtils.doWithMethods(target.getClass(), new MethodCallback() {
      @Override
      public void doWith(Method method) throws IllegalArgumentException,
          IllegalAccessException {
        if (AnnotationUtils.findAnnotation(method, Recover.class) != null) {
          foundRecoverable.set(true);
View Full Code Here

    }
   
    public boolean hasAnnotatedMethods(Class<?> clazz) {
      final AtomicBoolean found = new AtomicBoolean(false);
      ReflectionUtils.doWithMethods(clazz,
          new MethodCallback() {
            @Override
            public void doWith(Method method) throws IllegalArgumentException,
                IllegalAccessException {
              if (found.get()) {
                return;
View Full Code Here

  private void init(Object target, Method method) {
    final Map<Class<? extends Throwable>, Method> types = new HashMap<Class<? extends Throwable>, Method>();
    final Method failingMethod = method;
    ReflectionUtils.doWithMethods(failingMethod.getDeclaringClass(),
        new MethodCallback() {
          @Override
          public void doWith(Method method) throws IllegalArgumentException,
              IllegalAccessException {
            Recover recover = AnnotationUtils.findAnnotation(method,
                Recover.class);
View Full Code Here

    Mockito.when(quoteRepository.findBySymbol("VMW")).thenReturn(quote);
  }

  @Test
  public void test() {
    ReflectionUtils.doWithMethods(TradingServiceImpl.class, new MethodCallback() {
      @Override
      public void doWith(Method method) throws IllegalArgumentException,
          IllegalAccessException {
        if ("updateQuoteMarketData".equals(method.getName())) {
          method.setAccessible(true);
View Full Code Here

  @Override
  public Object postProcessAfterInitialization(final Object bean, String beanName) {
    if (!this.nonAnnotatedClasses.contains(bean.getClass())) {
      final Set<Method> annotatedMethods = new LinkedHashSet<Method>(1);
      Class<?> targetClass = AopUtils.getTargetClass(bean);
      ReflectionUtils.doWithMethods(targetClass, new MethodCallback() {
        @Override
        public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
          for (Scheduled scheduled :
              AnnotationUtils.getRepeatableAnnotation(method, Schedules.class, Scheduled.class)) {
            processScheduled(scheduled, method, bean);
View Full Code Here

        }
      }, filter);
    }

    if (members == Members.METHODS || members == Members.ALL) {
      doWithMethods(targetClass, new MethodCallback() {
        @Override
        public void doWith(final Method method) throws IllegalAccessException {
          withMethod(bean, beanName, targetClass, method);
        }
      }, filter);
View Full Code Here

  public Object postProcessAfterInitialization(final Object bean, String beanName) throws BeansException {
    Class<?> targetClass = AopUtils.getTargetClass(bean);
    if (targetClass == null) {
      return bean;
    }
    ReflectionUtils.doWithMethods(targetClass, new MethodCallback() {
      public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
        Scheduled annotation = AnnotationUtils.getAnnotation(method, Scheduled.class);
        if (annotation != null) {
          Assert.isTrue(void.class.equals(method.getReturnType()),
              "Only void-returning methods may be annotated with @Scheduled.");
View Full Code Here

    // use an int array just so we can have a final variable
    // contains the beanNames resolved based on the method signature
    final Set<String> noArgMethodsSeen = new HashSet<String>();

    ReflectionUtils.doWithMethods(configurationClass, new MethodCallback() {
      public void doWith(Method m) throws IllegalArgumentException, IllegalAccessException {
        Bean beanAnnotation = AnnotationUtils.findAnnotation(m, Bean.class);
        // Determine bean name
        String beanName = beanNamingStrategy.getBeanName(m);
View Full Code Here

    return bean;
  }

  public Object postProcessAfterInitialization(final Object bean, String beanName) {
    Class<?> targetClass = AopUtils.getTargetClass(bean);
    ReflectionUtils.doWithMethods(targetClass, new MethodCallback() {
      public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
        Scheduled annotation = AnnotationUtils.getAnnotation(method, Scheduled.class);
        if (annotation != null) {
          Assert.isTrue(void.class.equals(method.getReturnType()),
              "Only void-returning methods may be annotated with @Scheduled.");
View Full Code Here

TOP

Related Classes of org.springframework.util.ReflectionUtils.MethodCallback

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.