On Sat, Aug 4, 2012 at 11:23 AM, MarvinToll.com <[email protected]>wrote:

>
> **** Still a Newbie ****
>
> Context: All injectable plugins are sequentially bound at server startup
> with properties and unique names:
>
>
>
>             Names.*bindProperties*(binder(), properties);
>
>             // ********************************
>             // * Four Combinations Start Here *
>             // ********************************
>             if (this.pluginElementPO.isPluginCacheable()) {
>                 // Yes interface, yes singleton.
>                 bind(pluginInterface)
>                         .annotatedWith(Names.named(pluginUniqueName))
>                         .to(pluginConcrete).asEagerSingleton();
>             } else {
>                 // Yes interface, no singleton.
>                 bind(pluginInterface).annotatedWith(
>                         Names.named(pluginUniqueName)).to(pluginConcrete);
>             }
>         } else if (this.pluginElementPO.isPluginCacheable()) {
>             // No interface, yes singleton.
>
> bind(pluginConcrete).annotatedWith(Names.named(pluginUniqueName))
>                     .to(pluginConcrete).asEagerSingleton();
>         } else {
>             // No interface, no singleton.
>
> bind(pluginConcrete).annotatedWith(Names.named(pluginUniqueName))
>                     .to(pluginConcrete);
>         }
>
>
> Each concrete injectable plugin has a template method similar to the
> following for retrieving the Properties:
>
>     /**
>      * @see SjcBasePluginSI#retreivePluginPropertyPO()
>      */
>     @Override
>     public SjcPluginPropertyPO retreivePluginPropertyPO() {
>
>         return [*How do I get a reference to the Properties?*];
>

What do you expect here?   The full properties map?

Or is it a subset of properties (I'll assume that).  In that case, you'll
want to inject @Named("<property_name>") into your plugin for every plugin
you want to return.

As an alternative, you can bind the Properties as a first class object,
inject the properties into each property, and then extract the ones you
care about:

bind(Properties.class)
  .annoatedWith(ContainsPluginProperties.class)
  .toInstance(properties);

...

@Inject SjcPluginProperty(@ContainsPluginProperties Properties properties) {
   this.properties = properties;
}

...




>     }
>
> Excuse me if this is extraordinarily obvious.. I can't seem to forumulate
> the question in a way Google can understand.
>
> Marvin
> http://PatternEnabled.com
> <http://PatternEnabled.com>
> <http://PatternEnabled.com>
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-guice/-/WOM6YHUholYJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to