Package com.google.inject.binder

Examples of com.google.inject.binder.LinkedBindingBuilder


            key = Key.get(beanBinding.type, i.next());
          }
          else {
            key = Key.get(beanBinding.type);
          }
          LinkedBindingBuilder b = bind(key);

          //
          ScopedBindingBuilder c;
          if (beanBinding instanceof BeanBinding.ToInstance) {
            BeanBinding.ToInstance d = (BeanBinding.ToInstance)beanBinding;
            b.toInstance(d.instance);
            c = b;
          }
          else if (beanBinding instanceof BeanBinding.ToProviderInstance) {
            BeanBinding.ToProviderInstance d = (BeanBinding.ToProviderInstance)beanBinding;
            c = b.toProvider(d);
            if (beanBinding.scopeType != null) {
              c.in(beanBinding.scopeType);
            }
          }
          else {
            if (beanBinding instanceof BeanBinding.ToProviderType) {
              BeanBinding.ToProviderType d = (BeanBinding.ToProviderType)beanBinding;
              c = b.toProvider(d.provider);
            }
            else {
              BeanBinding.ToType d = (BeanBinding.ToType)beanBinding;
              if (d.qualifiers != null) {
                if (d.implementationType != null) {
                  c = b.to(d.implementationType);
                  // Guice trick : need to bind alias so the implementation type will be bound with the qualifier
                  bind(Key.get(d.implementationType, key.getAnnotation())).toProvider(new BeanAlias(key));
                }
                else {
                  c = b.to(beanBinding.type);
                }
              }
              else {
                if (d.implementationType != null) {
                  c = b.to(d.implementationType);
                }
                else {
                  c = b;
                }
              }
View Full Code Here

TOP

Related Classes of com.google.inject.binder.LinkedBindingBuilder

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.