Class Renderer

java.lang.Object
com.yahoo.component.provider.FreezableClass
com.yahoo.search.pagetemplates.model.Renderer
All Implemented Interfaces:
com.yahoo.component.provider.Freezable, PageElement

public final class Renderer extends com.yahoo.component.provider.FreezableClass implements PageElement
A description of a way to present data items from a source. All data items has a default renderer. This can be overridden or parametrized by an explicit renderer.
Author:
bratseth
  • Constructor Details

    • Renderer

      public Renderer(String name)
  • Method Details

    • getName

      public String getName()
      Returns the name of this renderer (never null). The name should be recognized by the system receiving results for rendering
    • setName

      public final void setName(String name)
    • getRendererFor

      public String getRendererFor()
      Returns the name of the kind of data this is a renderer for. This is used to allow frontends to dispatch the right data items (hits) to the right renderer in the case where the data consists of a heterogeneous list.

      This is null if this is a renderer for a whole section, or if this is a renderer for all kinds of data from a particular source and this is not frozen.

      Otherwise, it is either the name of the source this is the renderer for, or the renderer for all data items having this name as a type.

      This, a (frontend) dispatcher of data to renderers should for each data item:

      • use the renderer having the same name as any type name set of the data item
      • if no such renderer, use the renderer having rendererFor equal to the data items source
      • if no such renderer, use a default renderer
    • setRendererFor

      public void setRendererFor(String rendererFor)
    • parameters

      public Map<String,String> parameters()
      Returns the parameters of this renderer as a live reference (never null). The parameters will be passed to the renderer with each result
    • freeze

      public void freeze()
      Specified by:
      freeze in interface com.yahoo.component.provider.Freezable
      Overrides:
      freeze in class com.yahoo.component.provider.FreezableClass
    • accept

      public void accept(PageTemplateVisitor visitor)
      Accepts a visitor to this structure
      Specified by:
      accept in interface PageElement
    • toString

      public String toString()
      Overrides:
      toString in class Object