@SuppressWarnings({"rawtypes", "unchecked"}) public MediaType getMediaType(String contextName, Object obj) throws ContextTransformException { ContextTransformInterceptor interceptor = transformInterceptorMap.get(obj.getClass()); if (interceptor != null) return interceptor.getMediaType(obj); else return contextTransformMap.get(contextName).getMediaType(obj); }
@SuppressWarnings("rawtypes") public ContextTransformService( Collection<ContextTransformer> contextTransforms, Collection<ContextTransformInterceptor> contextTransformInterceptors) { if (contextTransforms != null) { for (ContextTransformer transform : contextTransforms) { contextTransformMap.put(transform.getContextName(), transform); } } if (contextTransformInterceptors != null) { for (ContextTransformInterceptor interceptor : contextTransformInterceptors) { transformInterceptorMap.put(interceptor.intercepts(), interceptor); } } }