@Override public <T> FactoryDescriptors addActiveFactoryDescriptor( Class<? extends Factory<T>> rawFactoryClass) throws MultiException, IllegalArgumentException { Collector collector = new Collector(); Utilities.checkFactoryType(rawFactoryClass, collector); collector.throwIfErrors(); final ActiveDescriptor<?> factoryDescriptor = addActiveDescriptor(rawFactoryClass); ActiveDescriptor<?> userMethodDescriptor = Utilities.createAutoFactoryDescriptor(rawFactoryClass, factoryDescriptor, locator); final ActiveDescriptor<?> methodDescriptor = addActiveDescriptor(userMethodDescriptor); return new FactoryDescriptorsImpl(factoryDescriptor, methodDescriptor); }
AnnotatedElementAnnotationInfo harden(AnnotatedElement ae) { Annotation[] hardenedElementAnnotations = elementAnnotationsReference.get(); Annotation[][] hardenedParamAnnotations = paramAnnotationsReference.get(); if (!Utilities.USE_SOFT_REFERENCE || (hardenedElementAnnotations == null) || (hardenedParamAnnotations == null)) { return Utilities.computeAEAI(ae); } return new AnnotatedElementAnnotationInfo(hardenedElementAnnotations, hasParams, hardenedParamAnnotations, isConstructor); } }
@Override public <T> ActiveDescriptor<T> addActiveDescriptor(Class<T> rawClass) throws IllegalArgumentException { AutoActiveDescriptor<T> ad = Utilities.createAutoDescriptor(rawClass, locator); checkReifiedDescriptor(ad); ActiveDescriptor<T> retVal = addActiveDescriptor(ad, false); ad.resetSelfDescriptor(retVal); return retVal; }
if (!preAnalyzed) { qualifiers = Collections.unmodifiableSet( Utilities.getAllQualifiers(implClass, baseDescriptor.getName(), collector)); ScopeInfo si = Utilities.getScopeAnnotationType(implClass, baseDescriptor, collector); scopeAnnotation = si.getScope(); scope = si.getAnnoType(); Utilities.checkFactoryType(implClass, collector); Method provideMethod = Utilities.getFactoryProvideMethod(implClass); if (provideMethod == null) { collector.addThrowable(new IllegalArgumentException("Could not find the provide method on the class " + implClass.getName())); Utilities.getAllQualifiers( provideMethod, Utilities.getDefaultNameFromMethod(provideMethod, collector), collector)); factoryProvidedType = Utilities.getFactoryProductionType(implClass); ScopeInfo si = Utilities.getScopeAnnotationType(provideMethod, baseDescriptor, collector); scopeAnnotation = si.getScope(); scope = si.getAnnoType(); if ((isProxiable() != null) && isProxiable().booleanValue() && Utilities.isUnproxiableScope(scope)) { collector.addThrowable(new IllegalArgumentException("The descriptor is in an Unproxiable scope but has " +
dci.bind(Utilities.getLocatorDescriptor(sli)); dci.addActiveDescriptor(Utilities.getThreeThirtyDescriptor(sli));
if (rawClass == null) return null; // Can't be a TypeVariable or Wildcard Utilities.checkLookupType(rawClass); rawClass = Utilities.translatePrimitiveType(rawClass); Utilities.handleErrors(results, currentErrorHandlers);
Utilities.handleErrors(results, currentErrorHandlers); Object service = Utilities.createService(candidate, null, this, null, rawClass);
/* package */ T getService(ServiceHandle<T> handle) { if (root instanceof Closeable) { Closeable closeable = (Closeable) root; if (closeable.isClosed()) { throw new IllegalStateException("This service has been unbound: " + root); } } synchronized (lock) { if (serviceDestroyed) throw new IllegalStateException("Service has been disposed"); if (serviceSet) return service; Injectee injectee = getLastInjectee(); Class<?> requiredClass = (injectee == null) ? null : ReflectionHelper.getRawClass(injectee.getRequiredType()); service = Utilities.createService(root, injectee, locator, handle, requiredClass); serviceSet = true; return service; } }
config.bind(Utilities.getLocatorDescriptor(locator));
@Override public <T> Set<Field> getFields(Class<T> clazz) throws MultiException { Collector collector = new Collector(); Set<Field> retVal = Utilities.findInitializerFields(clazz, locator, collector); collector.throwIfErrors(); return retVal; }
@Override public <T> Set<Method> getInitializerMethods(Class<T> clazz) throws MultiException { Collector collector = new Collector(); Set<Method> retVal = Utilities.findInitializerMethods(clazz, locator, collector); collector.throwIfErrors(); return retVal; }
if (!preAnalyzed) { qualifiers = Collections.unmodifiableSet( Utilities.getAllQualifiers(implClass, baseDescriptor.getName(), collector)); ScopeInfo si = Utilities.getScopeAnnotationType(implClass, baseDescriptor, collector); scopeAnnotation = si.getScope(); scope = si.getAnnoType(); Utilities.checkFactoryType(implClass, collector); Method provideMethod = Utilities.getFactoryProvideMethod(implClass); if (provideMethod == null) { collector.addThrowable(new IllegalArgumentException("Could not find the provide method on the class " + implClass.getName())); Utilities.getAllQualifiers( provideMethod, Utilities.getDefaultNameFromMethod(provideMethod, collector), collector)); factoryProvidedType = Utilities.getFactoryProductionType(implClass); ScopeInfo si = Utilities.getScopeAnnotationType(provideMethod, baseDescriptor, collector); scopeAnnotation = si.getScope(); scope = si.getAnnoType(); if ((isProxiable() != null) && isProxiable().booleanValue() && Utilities.isUnproxiableScope(scope)) { collector.addThrowable(new IllegalArgumentException("The descriptor is in an Unproxiable scope but has " +
dci.bind(Utilities.getLocatorDescriptor(sli)); dci.addActiveDescriptor(Utilities.getThreeThirtyDescriptor(sli));
if (rawClass == null) return null; // Can't be a TypeVariable or Wildcard Utilities.checkLookupType(rawClass); rawClass = Utilities.translatePrimitiveType(rawClass); Utilities.handleErrors(results, currentErrorHandlers);
Utilities.handleErrors(results, currentErrorHandlers); Object service = Utilities.createService(candidate, null, this, null, rawClass);
/* package */ T getService(ServiceHandle<T> handle) { if (root instanceof Closeable) { Closeable closeable = (Closeable) root; if (closeable.isClosed()) { throw new IllegalStateException("This service has been unbound: " + root); } } synchronized (lock) { if (serviceDestroyed) throw new IllegalStateException("Service has been disposed"); if (serviceSet) return service; Injectee injectee = getLastInjectee(); Class<?> requiredClass = (injectee == null) ? null : ReflectionHelper.getRawClass(injectee.getRequiredType()); service = Utilities.createService(root, injectee, locator, handle, requiredClass); serviceSet = true; return service; } }
config.bind(Utilities.getLocatorDescriptor(locator));
@Override public <T> Set<Field> getFields(Class<T> clazz) throws MultiException { Collector collector = new Collector(); Set<Field> retVal = Utilities.findInitializerFields(clazz, locator, collector); collector.throwIfErrors(); return retVal; }
@Override public <T> Set<Method> getInitializerMethods(Class<T> clazz) throws MultiException { Collector collector = new Collector(); Set<Method> retVal = Utilities.findInitializerMethods(clazz, locator, collector); collector.throwIfErrors(); return retVal; }
if (!preAnalyzed) { qualifiers = Collections.unmodifiableSet( Utilities.getAllQualifiers(implClass, baseDescriptor.getName(), collector)); ScopeInfo si = Utilities.getScopeAnnotationType(implClass, baseDescriptor, collector); scopeAnnotation = si.getScope(); scope = si.getAnnoType(); Utilities.checkFactoryType(implClass, collector); Method provideMethod = Utilities.getFactoryProvideMethod(implClass); if (provideMethod == null) { collector.addThrowable(new IllegalArgumentException("Could not find the provide method on the class " + implClass.getName())); Utilities.getAllQualifiers( provideMethod, Utilities.getDefaultNameFromMethod(provideMethod, collector), collector)); factoryProvidedType = Utilities.getFactoryProductionType(implClass); ScopeInfo si = Utilities.getScopeAnnotationType(provideMethod, baseDescriptor, collector); scopeAnnotation = si.getScope(); scope = si.getAnnoType(); if ((isProxiable() != null) && isProxiable().booleanValue() && Utilities.isUnproxiableScope(scope)) { collector.addThrowable(new IllegalArgumentException("The descriptor is in an Unproxiable scope but has " +