Thanks for helping me so quickly! :) As always :)

I guess I would have to try to implement a service that does this then. A
service that looks kind of like this:

public interface SetterInjector {
  void injectInto(Object instance);
}

And an implementation like this:

public class SetterInjectorImpl implements SetterInjector {
   private final ObjectLocator objectLocator;

   ...constructor with deps...

   public void injectInto(Object instance) {
      Method[] setters = getAllSetters(instance)
      for (Method setter:setters) {
         Object service =
objectLocator.getService(getClassForSetter(setter))
         setter.invoke(service)
      }
   }
}

Again, I'm surprised, I thought I remember seeing something like this in
the Tapestry source code somewhere. I'm probably wrong though.




On Mon, Aug 13, 2012 at 2:45 PM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Mon, 13 Aug 2012 09:31:55 -0300, Inge Solvoll <inge.tapes...@gmail.com>
> wrote:
>
>  So there doesn't exist an exposed API in tapestry for finding setters
>> that match services by type and invoke them runtime on non-tapestry-managed
>> instances?
>>
>
> Good question . . . Well, for part of it, you can inject ObjectLocator and
> use its getService() methods to get a service from the Tapestry-IoC
> registry. The setter part looks like something that some reflection code
> could do relatively easily.
>
>
> --
> Thiago H. de Paula Figueiredo
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org>
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to