public Map<Type, ContextInjector> getAsyncContextInjectors() { if (asyncContextInjectors == null && parent != null) return parent.getAsyncContextInjectors(); return asyncContextInjectors; }
private void addContextInjector(ContextInjector provider, Class providerClass) { Type[] typeArgs = Types.getActualTypeArgumentsOfAnInterface(providerClass, ContextInjector.class); injectProperties(provider.getClass(), provider); if (contextInjectors == null) { contextInjectors = new ConcurrentHashMap<Type, ContextInjector>(); contextInjectors.putAll(parent.getContextInjectors()); } contextInjectors.put(typeArgs[0], provider); if (!Objects.equals(typeArgs[0], typeArgs[1])) { if (asyncContextInjectors == null) { asyncContextInjectors = new ConcurrentHashMap<Type, ContextInjector>(); asyncContextInjectors.putAll(parent.getAsyncContextInjectors()); } asyncContextInjectors.put(typeArgs[1], provider); } }
public <T> T getContextData(Class<T> rawType, Type genericType, Annotation[] annotations, boolean unwrapAsync) { T ret = (T) ResteasyContext.getContextDataMap().get(rawType); if (ret != null) return ret; ContextInjector contextInjector = getContextInjectors().get(genericType); boolean async = false; if (contextInjector == null && unwrapAsync) { contextInjector = getAsyncContextInjectors().get(Types.boxPrimitives(genericType)); async = true; } if (contextInjector != null) { ret = (T) contextInjector.resolve(rawType, genericType, annotations); if (async && ret != null) { Type wrappedType = Types.getActualTypeArgumentsOfAnInterface(contextInjector.getClass(), ContextInjector.class)[0]; Class<?> rawWrappedType = Types.getRawType(wrappedType); AsyncResponseProvider converter = getAsyncResponseProvider(rawWrappedType); // OK this is plain lying ret = (T) converter.toCompletionStage(ret); } } return ret; }
asyncContextInjectors = parent == null ? new ConcurrentHashMap<>() : new ConcurrentHashMap<>(parent.getAsyncContextInjectors()); sortedParamConverterProviders = Collections.synchronizedSortedSet(parent == null ? new TreeSet<>() : new TreeSet<>(parent.getSortedParamConverterProviders())); stringParameterUnmarshallers = parent == null ? new ConcurrentHashMap<>() : new ConcurrentHashMap<>(parent.getStringParameterUnmarshallers());
public Map<Type, ContextInjector> getAsyncContextInjectors() { if (asyncContextInjectors == null && parent != null) return parent.getAsyncContextInjectors(); return asyncContextInjectors; }
private void addContextInjector(ContextInjector provider, Class providerClass) { Type[] typeArgs = Types.getActualTypeArgumentsOfAnInterface(providerClass, ContextInjector.class); injectProperties(provider.getClass(), provider); if (contextInjectors == null) { contextInjectors = new ConcurrentHashMap<Type, ContextInjector>(); contextInjectors.putAll(parent.getContextInjectors()); } contextInjectors.put(typeArgs[0], provider); if (!Objects.equals(typeArgs[0], typeArgs[1])) { if (asyncContextInjectors == null) { asyncContextInjectors = new ConcurrentHashMap<Type, ContextInjector>(); asyncContextInjectors.putAll(parent.getAsyncContextInjectors()); } asyncContextInjectors.put(typeArgs[1], provider); } }
public <T> T getContextData(Class<T> rawType, Type genericType, Annotation[] annotations, boolean unwrapAsync) { T ret = (T) ResteasyContext.getContextDataMap().get(rawType); if (ret != null) return ret; ContextInjector contextInjector = getContextInjectors().get(genericType); boolean async = false; if (contextInjector == null && unwrapAsync) { contextInjector = getAsyncContextInjectors().get(Types.boxPrimitives(genericType)); async = true; } if (contextInjector != null) { ret = (T) contextInjector.resolve(rawType, genericType, annotations); if (async && ret != null) { Type wrappedType = Types.getActualTypeArgumentsOfAnInterface(contextInjector.getClass(), ContextInjector.class)[0]; Class<?> rawWrappedType = Types.getRawType(wrappedType); AsyncResponseProvider converter = getAsyncResponseProvider(rawWrappedType); // OK this is plain lying ret = (T) converter.toCompletionStage(ret); } } return ret; }
asyncContextInjectors = parent == null ? new ConcurrentHashMap<>() : new ConcurrentHashMap<>(parent.getAsyncContextInjectors()); sortedParamConverterProviders = Collections.synchronizedSortedSet(parent == null ? new TreeSet<>() : new TreeSet<>(parent.getSortedParamConverterProviders())); stringParameterUnmarshallers = parent == null ? new ConcurrentHashMap<>() : new ConcurrentHashMap<>(parent.getStringParameterUnmarshallers());