Re: [Vala] Inverse of control in VALA?



(SORRY, sended before just partially)

Hi.

In any case you need some configuration. In google-guice they make the
configuration of 'when, what and how put something where' in the code:

"What, How"
public class MyModule implements Module {
 public void configure(Binder binder) {
   binder.bind(Service.class)
     .to(ServiceImpl.class)
     .in(Scopes.SINGLETON);
binder.bind(Service.class)
 .annotatedWith(Blue.class)
 .to(BlueService.class);
 }
}
"Where"
public class Client {
 private final Service service;
 @Inject
 public Client(Service service) {
   this.service = service;
 }
}
public class BlueClient {
 private final Service service;
 @Inject
 public Client(@Blue Service service) {
   this.service = service;
 }
}

For GObjects it is posible to use the interface GTypePlugin, but I
dont see how to inject dwo diferent implementations of the same
interface depending on some aditional context information (like the
guice example) .

On Tue, Jan 27, 2009 at 2:12 AM,  <christian hergert gmail com> wrote:
I agree, having types loaded at startup would make life a lot easier in most
of my situations. Is this already done with types in plugins when the plugin
is loaded?

-- Christian



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]