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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(PageTemplateVisitor visitor) Accepts a visitor to this structurevoid
freeze()
getName()
Returns the name of this renderer (never null).Returns the name of the kind of data this is a renderer for.Returns the parameters of this renderer as a live reference (never null).final void
void
setRendererFor
(String rendererFor) toString()
Methods inherited from class com.yahoo.component.provider.FreezableClass
clone, ensureNotFrozen, isFrozen
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.yahoo.component.provider.Freezable
isFrozen
-
Constructor Details
-
Renderer
-
-
Method Details
-
getName
Returns the name of this renderer (never null). The name should be recognized by the system receiving results for rendering -
setName
-
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
-
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
Accepts a visitor to this structure- Specified by:
accept
in interfacePageElement
-
toString
-