Announcement Announcement Module
No announcement yet.
AbstractMethodInvokingDelegator uses getDeclaredMethods Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • AbstractMethodInvokingDelegator uses getDeclaredMethods

    AbstractMethodInvokingDelegator in method targetClassDeclaresTargetMethod is using invoker.getTargetClass().getDeclaredMethods, this means we can't use inherited methods, any good reason for that? although getDeclaredMethods returns all methods i think we usually want to invoke a public method so getMethods would be good enough, isn't it?

  • #2
    I don't see a reason why it wouldn't, but Robert created the class. Can you create a jira issue for it?


    • #3
      did you refer to me for opening a jira issue?
      until this is fixed in future versions, my solution is to override ItemWriterAdapter and the method afterPropertiesSet and check if the method exists in targetObject with getMethods.
      but, there are no get methods for targetObject and targetMethod in AbstractMethodInvokingDelegator, which makes it hard for me to do it, i can do it with some ugly trick or skip this check and if the method does not exist it will fail on the first invocation. but i think there should be public or protected get methods for those two members.
      and this brings me to another issue i noticed in Spring Batch, it is not easy to extend classes and change behavior, the lack of get methods i mentioned above is an example and i see kind of programing all over Spring Batch, is that on purpose? is it going to change?