/* 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; } }
/* 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; } }
/* 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; } }
/* 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; } }
if (ad == null) return null; T retVal = Utilities.createService(ad, null, this, null, rawType);
if (ad == null) return null; T retVal = Utilities.createService(ad, null, this, null, rawType);
if (ad == null) return null; T retVal = Utilities.createService(ad, null, this, null, rawType);
if (ad == null) return null; T retVal = Utilities.createService(ad, null, this, null, rawType);
Object service = Utilities.createService(candidate, null, this, null, rawClass);
Object service = Utilities.createService(candidate, null, this, null, rawClass);
Object service = Utilities.createService(candidate, null, this, null, rawClass);
Object service = Utilities.createService(candidate, null, this, null, rawClass);
@SuppressWarnings("unchecked") @Override public <T> T getService(ActiveDescriptor<T> activeDescriptor, ServiceHandle<?> root, Injectee originalRequest) throws MultiException { checkState(); Type contractOrImpl = (originalRequest == null) ? null : originalRequest.getRequiredType(); Class<?> rawClass = ReflectionHelper.getRawClass(contractOrImpl); if (root == null) { ServiceHandleImpl<T> tmpRoot = new ServiceHandleImpl<T>(this, activeDescriptor, originalRequest); return Utilities.createService(activeDescriptor, originalRequest, this, tmpRoot, rawClass); } ServiceHandleImpl<?> rootImpl = (ServiceHandleImpl<?>) root; ServiceHandleImpl<T> subHandle = internalGetServiceHandle(activeDescriptor, contractOrImpl, originalRequest); if (PerLookup.class.equals(activeDescriptor.getScopeAnnotation())) { rootImpl.addSubHandle(subHandle); } rootImpl.pushInjectee(originalRequest); try { return subHandle.getService((ServiceHandle<T>) root); } finally { rootImpl.popInjectee(); } }
@SuppressWarnings("unchecked") @Override public <T> T getService(ActiveDescriptor<T> activeDescriptor, ServiceHandle<?> root, Injectee originalRequest) throws MultiException { checkState(); Type contractOrImpl = (originalRequest == null) ? null : originalRequest.getRequiredType(); Class<?> rawClass = ReflectionHelper.getRawClass(contractOrImpl); if (root == null) { ServiceHandleImpl<T> tmpRoot = new ServiceHandleImpl<T>(this, activeDescriptor, originalRequest); return Utilities.createService(activeDescriptor, originalRequest, this, tmpRoot, rawClass); } ServiceHandleImpl<?> rootImpl = (ServiceHandleImpl<?>) root; ServiceHandleImpl<T> subHandle = internalGetServiceHandle(activeDescriptor, contractOrImpl, originalRequest); if (PerLookup.class.equals(activeDescriptor.getScopeAnnotation())) { rootImpl.addSubHandle(subHandle); } rootImpl.pushInjectee(originalRequest); try { return subHandle.getService((ServiceHandle<T>) root); } finally { rootImpl.popInjectee(); } }
@SuppressWarnings("unchecked") @Override public <T> T getService(ActiveDescriptor<T> activeDescriptor, ServiceHandle<?> root, Injectee originalRequest) throws MultiException { checkState(); Type contractOrImpl = (originalRequest == null) ? null : originalRequest.getRequiredType(); Class<?> rawClass = ReflectionHelper.getRawClass(contractOrImpl); if (root == null) { ServiceHandleImpl<T> tmpRoot = new ServiceHandleImpl<T>(this, activeDescriptor, originalRequest); return Utilities.createService(activeDescriptor, originalRequest, this, tmpRoot, rawClass); } ServiceHandleImpl<?> rootImpl = (ServiceHandleImpl<?>) root; ServiceHandleImpl<T> subHandle = internalGetServiceHandle(activeDescriptor, contractOrImpl, originalRequest); if (PerLookup.class.equals(activeDescriptor.getScopeAnnotation())) { rootImpl.addSubHandle(subHandle); } rootImpl.pushInjectee(originalRequest); try { return subHandle.getService((ServiceHandle<T>) root); } finally { rootImpl.popInjectee(); } }
@SuppressWarnings("unchecked") @Override public <T> T getService(ActiveDescriptor<T> activeDescriptor, ServiceHandle<?> root, Injectee originalRequest) throws MultiException { checkState(); Type contractOrImpl = (originalRequest == null) ? null : originalRequest.getRequiredType(); Class<?> rawClass = ReflectionHelper.getRawClass(contractOrImpl); if (root == null) { ServiceHandleImpl<T> tmpRoot = new ServiceHandleImpl<T>(this, activeDescriptor, originalRequest); return Utilities.createService(activeDescriptor, originalRequest, this, tmpRoot, rawClass); } ServiceHandleImpl<?> rootImpl = (ServiceHandleImpl<?>) root; ServiceHandleImpl<T> subHandle = internalGetServiceHandle(activeDescriptor, contractOrImpl, originalRequest); if (PerLookup.class.equals(activeDescriptor.getScopeAnnotation())) { rootImpl.addSubHandle(subHandle); } rootImpl.pushInjectee(originalRequest); try { return subHandle.getService((ServiceHandle<T>) root); } finally { rootImpl.popInjectee(); } }