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,Cloneable,Comparable<com.yahoo.component.Component>
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
-
Field Summary
Fields inherited from class com.yahoo.component.AbstractComponent
isDeconstructable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeginGroup(WRITER writer, Group group) Same as beginHitGroup, but for Group(grouping api).voidbeginGroupList(WRITER writer, GroupList groupList) Same as beginHitGroup, but for GroupList(grouping api).abstract voidbeginHitGroup(WRITER writer, HitGroup hitGroup) Called when a HitGroup is encountered.voidbeginHitList(WRITER writer, HitList hitList) Same as beginHitGroup, but for HitList(grouping api).abstract voidbeginResult(WRITER writer, Result result) Called at the start of rendering.abstract voidemptyResult(WRITER writer, Result result) Called if there are no hits in the result.voidSame as endHitGroup, but for Group(grouping api).voidendGroupList(WRITER writer, GroupList groupList) Same as endHitGroup, but for GroupList(grouping api).abstract voidendHitGroup(WRITER writer, HitGroup hitGroup) Called after all the children of the HitGroup have been provided to methods of this class.voidendHitList(WRITER writer, HitList hitList) Same as endHitGroup, but for HitList(grouping api).abstract voidCalled at the end of rendering.abstract voiderror(WRITER writer, Collection<ErrorMessage> errorMessages) Called if there are errors in the result.voidCalled when an errorHit is encountered.abstract voidCalled when a Hit is encountered.abstract voidqueryContext(WRITER writer, QueryContext queryContext) Called if there is a non-null query context for the query of the result.final voidPicks apart the result and feeds it to the other methods.wrapWriter(Writer writer) Wraps the Writer instance.Methods inherited from class com.yahoo.search.rendering.Renderer
clone, getCharacterEncoding, getDefaultSummaryClass, getRequestedEncoding, renderResponseMethods inherited from class com.yahoo.processing.rendering.Renderer
getEncoding, getMimeType, initMethods inherited from class com.yahoo.component.AbstractComponent
compareTo, deconstruct, getClassName, getId, getIdString, hasInitializedId, initId, isDeconstructable, setIsDeconstructable, toString
-
Constructor Details
-
SectionedRenderer
public SectionedRenderer()
-
-
Method Details
-
wrapWriter
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
Called at the start of rendering.- Throws:
IOException
-
endResult
Called at the end of rendering.- Throws:
IOException
-
error
public abstract void error(WRITER writer, Collection<ErrorMessage> errorMessages) throws IOException Called if there are errors in the result.- Throws:
IOException
-
emptyResult
Called if there are no hits in the result.- Throws:
IOException
-
queryContext
Called if there is a non-null query context for the query of the result.- Throws:
IOException
-
beginHitGroup
Called when a HitGroup is encountered. After all its children have been provided to methods of this class, endHitGroup is called.- Throws:
IOException
-
endHitGroup
Called after all the children of the HitGroup have been provided to methods of this class. See beginHitGroup.- Throws:
IOException
-
hit
Called when a Hit is encountered.- Throws:
IOException
-
errorHit
Called when an errorHit is encountered. Forwards to hit() per default.- Throws:
IOException
-
beginGroup
Same as beginHitGroup, but for Group(grouping api). Forwards to beginHitGroup() per default.- Throws:
IOException
-
endGroup
Same as endHitGroup, but for Group(grouping api). Forwards to endHitGroup() per default.- Throws:
IOException
-
beginGroupList
Same as beginHitGroup, but for GroupList(grouping api). Forwards to beginHitGroup() per default.- Throws:
IOException
-
endGroupList
Same as endHitGroup, but for GroupList(grouping api). Forwards to endHitGroup() per default.- Throws:
IOException
-
beginHitList
Same as beginHitGroup, but for HitList(grouping api). Forwards to beginHitGroup() per default.- Throws:
IOException
-
endHitList
Same as endHitGroup, but for HitList(grouping api). Forwards to endHitGroup() per default.- Throws:
IOException
-
render
Picks apart the result and feeds it to the other methods.- Specified by:
renderin classRenderer- Throws:
IOException
-