Package com.yahoo.search.rendering
Class SectionedRenderer<WRITER>
- java.lang.Object
-
- com.yahoo.component.AbstractComponent
-
- com.yahoo.processing.rendering.Renderer<Result>
-
- com.yahoo.search.rendering.Renderer
-
- com.yahoo.search.rendering.SectionedRenderer<WRITER>
-
- All Implemented Interfaces:
com.yahoo.component.Component
,com.yahoo.component.Deconstructable
,java.lang.Cloneable
,java.lang.Comparable<com.yahoo.component.Component>
public abstract class SectionedRenderer<WRITER> extends Renderer
Renders each part of a result to a writer. 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 SectionedRenderer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
beginGroup(WRITER writer, Group group)
Same as beginHitGroup, but for Group(grouping api).void
beginGroupList(WRITER writer, GroupList groupList)
Same as beginHitGroup, but for GroupList(grouping api).abstract void
beginHitGroup(WRITER writer, HitGroup hitGroup)
Called when a HitGroup is encountered.void
beginHitList(WRITER writer, HitList hitList)
Same as beginHitGroup, but for HitList(grouping api).abstract void
beginResult(WRITER writer, Result result)
Called at the start of rendering.abstract void
emptyResult(WRITER writer, Result result)
Called if there are no hits in the result.void
endGroup(WRITER writer, Group group)
Same as endHitGroup, but for Group(grouping api).void
endGroupList(WRITER writer, GroupList groupList)
Same as endHitGroup, but for GroupList(grouping api).abstract void
endHitGroup(WRITER writer, HitGroup hitGroup)
Called after all the children of the HitGroup have been provided to methods of this class.void
endHitList(WRITER writer, HitList hitList)
Same as endHitGroup, but for HitList(grouping api).abstract void
endResult(WRITER writer, Result result)
Called at the end of rendering.abstract void
error(WRITER writer, java.util.Collection<ErrorMessage> errorMessages)
Called if there are errors in the result.void
errorHit(WRITER writer, ErrorHit errorHit)
Called when an errorHit is encountered.abstract void
hit(WRITER writer, Hit hit)
Called when a Hit is encountered.abstract void
queryContext(WRITER writer, QueryContext queryContext)
Called if there is a non-null query context for the query of the result.void
render(java.io.Writer writer, Result result)
Picks apart the result and feeds it to the other methods.WRITER
wrapWriter(java.io.Writer writer)
Wraps the Writer instance.-
Methods inherited from class com.yahoo.search.rendering.Renderer
clone, getCharacterEncoding, getDefaultSummaryClass, getRequestedEncoding, render
-
-
-
-
Method Detail
-
wrapWriter
public WRITER wrapWriter(java.io.Writer writer)
Wraps the Writer instance. The result is given as a parameter to all the callback methods. Must be overridden if the generic parameter WRITER != java.io.Writer.
-
beginResult
public abstract void beginResult(WRITER writer, Result result) throws java.io.IOException
Called at the start of rendering.- Throws:
java.io.IOException
-
endResult
public abstract void endResult(WRITER writer, Result result) throws java.io.IOException
Called at the end of rendering.- Throws:
java.io.IOException
-
error
public abstract void error(WRITER writer, java.util.Collection<ErrorMessage> errorMessages) throws java.io.IOException
Called if there are errors in the result.- Throws:
java.io.IOException
-
emptyResult
public abstract void emptyResult(WRITER writer, Result result) throws java.io.IOException
Called if there are no hits in the result.- Throws:
java.io.IOException
-
queryContext
public abstract void queryContext(WRITER writer, QueryContext queryContext) throws java.io.IOException
Called if there is a non-null query context for the query of the result.- Throws:
java.io.IOException
-
beginHitGroup
public abstract void beginHitGroup(WRITER writer, HitGroup hitGroup) throws java.io.IOException
Called when a HitGroup is encountered. After all its children have been provided to methods of this class, endHitGroup is called.- Throws:
java.io.IOException
-
endHitGroup
public abstract void endHitGroup(WRITER writer, HitGroup hitGroup) throws java.io.IOException
Called after all the children of the HitGroup have been provided to methods of this class. See beginHitGroup.- Throws:
java.io.IOException
-
hit
public abstract void hit(WRITER writer, Hit hit) throws java.io.IOException
Called when a Hit is encountered.- Throws:
java.io.IOException
-
errorHit
public void errorHit(WRITER writer, ErrorHit errorHit) throws java.io.IOException
Called when an errorHit is encountered. Forwards to hit() per default.- Throws:
java.io.IOException
-
beginGroup
public void beginGroup(WRITER writer, Group group) throws java.io.IOException
Same as beginHitGroup, but for Group(grouping api). Forwards to beginHitGroup() per default.- Throws:
java.io.IOException
-
endGroup
public void endGroup(WRITER writer, Group group) throws java.io.IOException
Same as endHitGroup, but for Group(grouping api). Forwards to endHitGroup() per default.- Throws:
java.io.IOException
-
beginGroupList
public void beginGroupList(WRITER writer, GroupList groupList) throws java.io.IOException
Same as beginHitGroup, but for GroupList(grouping api). Forwards to beginHitGroup() per default.- Throws:
java.io.IOException
-
endGroupList
public void endGroupList(WRITER writer, GroupList groupList) throws java.io.IOException
Same as endHitGroup, but for GroupList(grouping api). Forwards to endHitGroup() per default.- Throws:
java.io.IOException
-
beginHitList
public void beginHitList(WRITER writer, HitList hitList) throws java.io.IOException
Same as beginHitGroup, but for HitList(grouping api). Forwards to beginHitGroup() per default.- Throws:
java.io.IOException
-
endHitList
public void endHitList(WRITER writer, HitList hitList) throws java.io.IOException
Same as endHitGroup, but for HitList(grouping api). Forwards to endHitGroup() per default.- Throws:
java.io.IOException
-
-