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

    Fields
    Modifier and Type
    Field
    Description
    static 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

    Constructors
    Constructor
    Description
    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.
    Creates a registry containing the built-in renderers only, using a custom executor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Must be called when use of this is discontinued to free the resources it has allocated
    com.yahoo.processing.rendering.Renderer<Result>
    Returns the default JSON renderer
    com.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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public RendererRegistry(Executor executor)
      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

      public com.yahoo.processing.rendering.Renderer<Result> 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