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 Summary
Constructors Constructor Description Renderer(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(PageTemplateVisitor visitor)
Accepts a visitor to this structurevoid
freeze()
java.lang.String
getName()
Returns the name of this renderer (never null).java.lang.String
getRendererFor()
Returns the name of the kind of data this is a renderer for.java.util.Map<java.lang.String,java.lang.String>
parameters()
Returns the parameters of this renderer as a live reference (never null).void
setName(java.lang.String name)
void
setRendererFor(java.lang.String rendererFor)
java.lang.String
toString()
-
Methods inherited from class com.yahoo.component.provider.FreezableClass
clone, ensureNotFrozen, isFrozen
-
-
-
-
Method Detail
-
getName
public java.lang.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(java.lang.String name)
-
getRendererFor
public java.lang.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 itemssource
- if no such renderer, use a default renderer
- use the renderer having the same name as any
-
setRendererFor
public void setRendererFor(java.lang.String rendererFor)
-
parameters
public java.util.Map<java.lang.String,java.lang.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 interfacecom.yahoo.component.provider.Freezable
- Overrides:
freeze
in classcom.yahoo.component.provider.FreezableClass
-
accept
public void accept(PageTemplateVisitor visitor)
Accepts a visitor to this structure- Specified by:
accept
in interfacePageElement
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-