public synchronized EngineConfig registerNamedRenderer(NamedRenderer renderer) { namedRenderers.put(renderer.getName(), renderer); Set<Class<?>> supportedClasses = Util.asSet(renderer.getSupportedClasses()); for (Class<?> clazz : supportedClasses) { Class<?> classInHierarchy = clazz; while (classInHierarchy != null) { addSupportedRenderer(classInHierarchy, renderer); classInHierarchy = classInHierarchy.getSuperclass(); } } return this; }
public synchronized EngineConfig deregisterNamedRenderer(NamedRenderer renderer) { namedRenderers.remove(renderer.getName()); Set<Class<?>> supportedClasses = Util.asSet(renderer.getSupportedClasses()); for (Class<?> clazz : supportedClasses) { Class<?> classInHierarchy = clazz; while (classInHierarchy != null) { Set<NamedRenderer> renderers = namedRenderersForClass.get(classInHierarchy); renderers.remove(renderer); classInHierarchy = classInHierarchy.getSuperclass(); } } return this; }