Class 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
    • Constructor Summary

      Constructors 
      Constructor Description
      RendererRegistry()
      Creates a registry containing the built-in renderers only
      RendererRegistry​(java.util.Collection<com.yahoo.processing.rendering.Renderer> renderers)
      Creates a registry of the given renderers plus the built-in ones
      RendererRegistry​(java.util.Collection<com.yahoo.processing.rendering.Renderer> renderers, java.util.concurrent.Executor executor)
      Creates a registry of the given renderers plus the built-in ones, using a custom executor.
      RendererRegistry​(java.util.concurrent.Executor executor)
      Creates a registry containing the built-in renderers only, using a custom executor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void deconstruct()
      Must be called when use of this is discontinued to free the resources it has allocated
      com.yahoo.processing.rendering.Renderer<Result> getDefaultRenderer()
      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 Detail

      • 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 Detail

      • RendererRegistry

        public RendererRegistry()
        Creates a registry containing the built-in renderers only
      • RendererRegistry

        public RendererRegistry​(java.util.concurrent.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​(java.util.Collection<com.yahoo.processing.rendering.Renderer> renderers)
        Creates a registry of the given renderers plus the built-in ones
      • RendererRegistry

        public RendererRegistry​(java.util.Collection<com.yahoo.processing.rendering.Renderer> renderers,
                                java.util.concurrent.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 Detail

      • 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:
        java.lang.IllegalArgumentException - if the renderer cannot be resolved