Package com.yahoo.search.rendering
Class Renderer
- java.lang.Object
-
- com.yahoo.component.AbstractComponent
-
- com.yahoo.processing.rendering.Renderer<Result>
-
- com.yahoo.search.rendering.Renderer
-
- All Implemented Interfaces:
com.yahoo.component.Component
,com.yahoo.component.Deconstructable
,java.lang.Cloneable
,java.lang.Comparable<com.yahoo.component.Component>
- Direct Known Subclasses:
SectionedRenderer
,SyncDefaultRenderer
public abstract class Renderer extends com.yahoo.processing.rendering.Renderer<Result>
Renders a search result to a writer synchronously - the result is completely rendered when the render method returns. The renderers are cloned just before rendering, and must therefore obey the following contract:- At construction time, only final members shall be initialized, and these must refer to immutable data only.
- State mutated during rendering shall be initialized in the init method.
- Author:
- Tony Vaagenes
-
-
Constructor Summary
Constructors Constructor Description Renderer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Renderer
clone()
Used to create a separate instance for each result to render.java.lang.String
getCharacterEncoding(Result result)
java.lang.String
getDefaultSummaryClass()
java.lang.String
getRequestedEncoding(Query query)
Returns the encoding of the query, or the encoding given by the template if none is setcom.google.common.util.concurrent.ListenableFuture<java.lang.Boolean>
render(java.io.OutputStream stream, Result response, com.yahoo.processing.execution.Execution execution, com.yahoo.processing.Request request)
Renders synchronously and returns when rendering is complete.protected abstract void
render(java.io.Writer writer, Result result)
Renders the result to the writer.
-
-
-
Method Detail
-
render
public final com.google.common.util.concurrent.ListenableFuture<java.lang.Boolean> render(java.io.OutputStream stream, Result response, com.yahoo.processing.execution.Execution execution, com.yahoo.processing.Request request)
Renders synchronously and returns when rendering is complete.- Specified by:
render
in classcom.yahoo.processing.rendering.Renderer<Result>
- Returns:
- a future which is always completed to true
-
render
protected abstract void render(java.io.Writer writer, Result result) throws java.io.IOException
Renders the result to the writer.- Throws:
java.io.IOException
-
getCharacterEncoding
public java.lang.String getCharacterEncoding(Result result)
-
getDefaultSummaryClass
public java.lang.String getDefaultSummaryClass()
- Returns:
- The summary class to fill the hits with if no summary class was specified in the query presentation.
-
getRequestedEncoding
public final java.lang.String getRequestedEncoding(Query query)
Returns the encoding of the query, or the encoding given by the template if none is set
-
-