Package com.yahoo.search.rendering
Class RendererRegistry
java.lang.Object
com.yahoo.component.provider.ComponentRegistry<com.yahoo.processing.rendering.Renderer<Result>>
com.yahoo.search.rendering.RendererRegistry
public final class RendererRegistry
extends com.yahoo.component.provider.ComponentRegistry<com.yahoo.processing.rendering.Renderer<Result>>
Holds all configured and built-in renderers.
This registry is always frozen.
- Author:
- bratseth
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.yahoo.component.ComponentId
static final com.yahoo.component.ComponentId
static final com.yahoo.component.ComponentId
static final com.yahoo.component.ComponentId
-
Constructor Summary
ConstructorDescriptionRendererRegistry
(Collection<com.yahoo.processing.rendering.Renderer> renderers, Executor executor) Creates a registry of the given renderers plus the built-in ones, using a custom executor.RendererRegistry
(Executor executor) Creates a registry containing the built-in renderers only, using a custom executor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Must be called when use of this is discontinued to free the resources it has allocatedcom.yahoo.processing.rendering.Renderer<Result>
Returns the default JSON renderercom.yahoo.processing.rendering.Renderer<Result>
getRenderer
(com.yahoo.component.ComponentSpecification format) Returns the requested renderer.Methods inherited from class com.yahoo.component.provider.ComponentRegistry
allComponents, allComponentsById, findBestMatch, freeze, getComponent, getComponent, getComponent, getComponentCount, isFrozen, register, singleton, unregister
-
Field Details
-
xmlRendererId
public static final com.yahoo.component.ComponentId xmlRendererId -
pageRendererId
public static final com.yahoo.component.ComponentId pageRendererId -
jsonRendererId
public static final com.yahoo.component.ComponentId jsonRendererId -
defaultRendererId
public static final com.yahoo.component.ComponentId defaultRendererId
-
-
Constructor Details
-
RendererRegistry
Creates a registry containing the built-in renderers only, using a custom executor. Using a custom executor is useful for tests to avoid creating new threads for each renderer registry: Use MoreExecutors.directExecutor(). -
RendererRegistry
public RendererRegistry(Collection<com.yahoo.processing.rendering.Renderer> renderers, Executor executor) Creates a registry of the given renderers plus the built-in ones, using a custom executor. Using a custom executor is useful for tests to avoid creating new threads for each renderer registry.
-
-
Method Details
-
deconstruct
public void deconstruct()Must be called when use of this is discontinued to free the resources it has allocated -
getDefaultRenderer
Returns the default JSON renderer- Returns:
- the default built-in result renderer
-
getRenderer
public com.yahoo.processing.rendering.Renderer<Result> getRenderer(com.yahoo.component.ComponentSpecification format) Returns the requested renderer.- Parameters:
format
- the id or format alias of the renderer to return. If null is passed the default renderer is returned- Throws:
IllegalArgumentException
- if the renderer cannot be resolved
-