This method can be called by classes extending SetupServer to retrieve
the actual injector. This requires some inside knowledge on where it is
stored, but the actual key is not visible outside the guice packages.
171372
public Injector injector(final ServletContextEvent event)
    {
        return (Injector) event.getServletContext().getAttribute(Injector.class.getName());
    }
218102
def get_referenced_object(self):
        

        if self._DeviceServer is not None:
            return self._DeviceServer

        raise exception.BunqException(self._ERROR_NULL_FIELDS)
880784
def get_provider(cls, scm_name: str, conf) -> SourceControl:
        
        for entry_point in pkg_resources.iter_entry_points('yabt.scm',
                                                           scm_name):
            entry_point.load()
            logger.debug('Loaded SCM provider {0.name} from {0.module_name} '
                         '(dist {0.dist})', entry_point)
        logger.debug('Loaded {} SCM providers', len(cls.providers))
        if scm_name not in cls.providers:
            raise KeyError('Unknown SCM identifier {}'.format(scm_name))
        return cls.providers[scm_name](conf)
981552
public static Map<Key<?>, Binding<?>> findBindingsInScope(Injector injector, Scope... scopes) {
    Map<Key<?>,Binding<?>> bindings = new LinkedHashMap<Key<?>, Binding<?>>();
    ALL_BINDINGS: for( Map.Entry<Key<?>, Binding<?>> entry : injector.getAllBindings().entrySet() ) {
      for( Scope scope : scopes ) {
        if( inScope(injector, entry.getValue(), scope )) {
          bindings.put(entry.getKey(), entry.getValue());
          continue ALL_BINDINGS;
        }
      }
    }
    return bindings;
  }
729848
static String getBuiltInBindingsKey(String key) {
    int start = startOfType(key);
    if (substringStartsWith(key, start, PROVIDER_PREFIX)) {
      return extractKey(key, start, key.substring(0, start), PROVIDER_PREFIX);
    } else if (substringStartsWith(key, start, MEMBERS_INJECTOR_PREFIX)) {
      return extractKey(key, start, "members/", MEMBERS_INJECTOR_PREFIX);
    } else {
      return null;
    }
  }
1146403
@Override
    public T inject(ReferenceContext referenceContext) throws ManagedObjectException {
        T instance = getObject();
        //if there is no referenceContext then just skip straight to CDI injection
        if (referenceContext == null) {
            instance = cdiInjection(instance);
        } else {
            //get all the WS Injection Targets from the supplied reference context
            com.ibm.wsspi.injectionengine.InjectionTarget[] injectionTargets;
            try {
                injectionTargets = referenceContext.getInjectionTargets(instance.getClass());
            } catch (InjectionException e) {
                throw new ManagedObjectException(e);
            }

            InjectionTargetContext injectionContext = new InjectionTargetContext() {
                @Override
                public <S> S getInjectionTargetContextData(Class<S> data) {
                    return getContextData(data);
                }
            };
            //call inject using the injection targets
            instance = inject(injectionTargets, injectionContext);
        }

        return instance;
    }
430619
private List<Pair<Id, GuiceSupplier>> getSuppliers() {
        ImmutableList.Builder<Pair<Id, GuiceSupplier>> suppliersBuilder = ImmutableList.builder();
        for (Binding<GuiceRegistration> registrationBinding : injector.findBindingsByType(TypeLiteral.get(GuiceRegistration.class))) {
            Key<?> key = registrationBinding.getProvider().get().key();
            suppliersBuilder.add(newPair(key));
        }
        return suppliersBuilder.build();
    }
66515
def get_getter(self, kind, sid):
        
        hdf5cache = getattr(self, 'hdf5cache', None)
        if hdf5cache:
            dstore = hdf5cache
        elif (self.oqparam.hazard_calculation_id and
              'gmf_data' not in self.datastore):
            # 'gmf_data' in self.datastore happens for ShakeMap calculations
            self.datastore.parent.close()  # make sure it is closed
            dstore = self.datastore.parent
        else:
            dstore = self.datastore
        if kind == 'poe':  # hcurves, shape (R, N)
            getter = getters.PmapGetter(dstore, self.rlzs_assoc, [sid])
        else:  # gmf
            getter = getters.GmfDataGetter(dstore, [sid], self.R)
        if dstore is self.datastore:
            getter.init()
        return getter
692249
public <S, T> Converter<S, T> findConverter(ConverterKey<S,T> key) {
		
		 // We check once before attempting introspection so we avoid that if possible
		@SuppressWarnings("unchecked")
		Converter<S,T> converter = (Converter<S, T>) registeredConverters.get(key);
		if (converter != null) {
			return converter;
		}
		
		// Now try introspecting the relevant class
		registerAnnotatedClasses(key.getInputClass(), key.getOutputClass());

		@SuppressWarnings("unchecked")
		Converter<S,T> myConverter = (Converter<S, T>) registeredConverters.get(key);
		return myConverter;
	}
540674
private <T> Provider<T> lookupProvider(InjectionPoint<T> ip)
  {
    Key<T> key = ip.key();

    BindingInject<T> bean = findBean(key);

    if (bean != null) {
      return bean.provider(ip);
    }

    BindingAmp<T> provider = findBinding(key);

    if (provider != null) {
      return provider.provider(ip);
    }

    provider = findObjectBinding(key);

    if (provider != null) {
      return provider.provider(ip);
    }


    return null;
  }
388379
@Override
    public CacheKey getCacheKey(HttpServletRequest request, HttpServletResponse response)
            throws IllegalStateException {
        if (this.wrappedComponent != null) {
            return this.wrappedComponent.getCacheKey(request, response);
        } else {
            logger.debug("PipelineComponentWrapper.wrapperComponent is null");
            throw new IllegalStateException("PipelineComponentWrapper.wrapperComponent is null");
        }
    }
731636
private boolean isEnvEntryType(Class<?> resolverType) // F743-32443
    {
        Class<?> injectType = getInjectionClassType();
        return injectType == null ? resolverType.getName().equals(getInjectionClassTypeName())
                        : resolverType == injectType;
    }
161468
def get_gce_driver(self):
        
        # Attempt to get GCE params from a configuration file, if one
        # exists.
        secrets_path = self.config.get('gce', 'libcloud_secrets')
        secrets_found = False
        try:
            import secrets
            args = list(getattr(secrets, 'GCE_PARAMS', []))
            kwargs = getattr(secrets, 'GCE_KEYWORD_PARAMS', {})
            secrets_found = True
        except:
            pass

        if not secrets_found and secrets_path:
            if not secrets_path.endswith('secrets.py'):
                err = "Must specify libcloud secrets file as "
                err += "/absolute/path/to/secrets.py"
                sys.exit(err)
            sys.path.append(os.path.dirname(secrets_path))
            try:
                import secrets
                args = list(getattr(secrets, 'GCE_PARAMS', []))
                kwargs = getattr(secrets, 'GCE_KEYWORD_PARAMS', {})
                secrets_found = True
            except:
                pass
        if not secrets_found:
            args = [
                self.config.get('gce','gce_service_account_email_address'),
                self.config.get('gce','gce_service_account_pem_file_path')
            ]
            kwargs = {'project': self.config.get('gce', 'gce_project_id')}

        # If the appropriate environment variables are set, they override
        # other configuration; process those into our args and kwargs.
        args[0] = os.environ.get('GCE_EMAIL', args[0])
        args[1] = os.environ.get('GCE_PEM_FILE_PATH', args[1])
        kwargs['project'] = os.environ.get('GCE_PROJECT', kwargs['project'])

        # Retrieve and return the GCE driver.
        gce = get_driver(Provider.GCE)(*args, **kwargs)
        gce.connection.user_agent_append(
            '%s/%s' % (USER_AGENT_PRODUCT, USER_AGENT_VERSION),
        )
        return gce
558183
static String getConfigKey(InjectionPoint ip, ConfigProperty configProperty) {
        String key = configProperty.name();
        if (key.length() > 0) {
            return key;
        }
        if (ip.getAnnotated() instanceof AnnotatedMember) {
            AnnotatedMember member = (AnnotatedMember) ip.getAnnotated();
            AnnotatedType declaringType = member.getDeclaringType();
            if (declaringType != null) {
                return declaringType.getJavaClass().getCanonicalName() + "." + member.getJavaMember().getName();
            }
        }

        throw new IllegalStateException("Could not find default name for @ConfigProperty InjectionPoint " + ip);
    }
1017886
private <T> BindingInject<T> findBean(Key<T> key)
  {
    for (InjectProvider provider : _providerList) {
      BindingInject<T> bean = (BindingInject) provider.lookup(key.rawClass());

      if (bean != null) {
        return bean;
      }
    }

    return null;
  }
1124035
private Iterable<Binding<?>> getBindings(Injector injector, Set<Key<?>> root) {
        Set<Key<?>> keys = Sets.newHashSet(root);
        Set<Key<?>> visitedKeys = Sets.newHashSet();
        List<Binding<?>> bindings = Lists.newArrayList();
        TransitiveDependencyVisitor keyVisitor = new TransitiveDependencyVisitor();

        while (!keys.isEmpty()) {
            Iterator<Key<?>> iterator = keys.iterator();
            Key<?> key = iterator.next();
            iterator.remove();

            if (!visitedKeys.contains(key)) {
                try {
                    Binding<?> binding = injector.getBinding(key);
                    bindings.add(binding);
                    visitedKeys.add(key);
                    keys.addAll(binding.acceptTargetVisitor(keyVisitor));
                }
                catch (ConfigurationException e) {
                    System.out.println("Missing binding for : " + key);
                    visitedKeys.add(key);
                }
            }
        }
        return bindings;
    }
1129272
private void readObject(java.io.ObjectInputStream in) throws IOException,
                    ClassNotFoundException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "readObject");

        ivPuId = (JPAPuId) in.readObject();
        ivJ2eeName = (J2EEName) in.readObject(); // d510184

        // restore the provider factory from JPA Service via puInfo object.
        //F743-16027 - using JPAAccessor to get JPAComponent, rather than using cached (possibly stale) static reference
        JPAPUnitInfo puInfo = ((AbstractJPAComponent) JPAAccessor.getJPAComponent()).findPersistenceUnitInfo(ivPuId); // d416151.3.5, F743-18776

        ivFactory = puInfo.getEntityManagerFactory(ivJ2eeName); // d510184

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "readObject : " + this);
    }