@SuppressWarnings("unchecked") <T> ConstructionContext<T> getConstructionContext(Object key) { ConstructionContext<T> constructionContext = (ConstructionContext<T>) constructionContexts.get(key); if (constructionContext == null) { constructionContext = new ConstructionContext<T>(); constructionContexts.put(key, constructionContext); } return constructionContext; }
if (constructionContext.isConstructing()) { return constructionContext.createProxy(expectedType); T t = constructionContext.getCurrentReference(); if (t != null) { return t; constructionContext.startConstruction(); try { Object[] parameters = getParameters(constructor, context, parameterInjectors); t = constructor.newInstance(parameters); constructionContext.setProxyDelegates(t); } finally { constructionContext.finishConstruction(); constructionContext.setCurrentReference(t); throw new RuntimeException(e); } finally { constructionContext.removeCurrentReference();