@Deprecated public abstract class UserTemplate<T extends Writer> extends GenericTemplateSet
A subclass of UserTemplate must implement header(), footer(), hit(), hitFooter(), error() and noHits().
Modifier and Type | Field and Description |
---|---|
private static byte[] |
ampersand
Deprecated.
|
private static byte[] |
greaterThan
Deprecated.
|
private static byte[] |
lessThan
Deprecated.
|
private static Logger |
log
Deprecated.
|
private static byte[] |
quotePrefix
Deprecated.
|
DEFAULT_ENCODING, DEFAULT_MIMETYPE
Constructor and Description |
---|
UserTemplate(String name)
Deprecated.
|
UserTemplate(String name,
String mimeType,
String encoding)
Deprecated.
The signature of this constructor is the one which is invoked
in a production setting.
|
Modifier and Type | Method and Description |
---|---|
Context |
createContext()
Deprecated.
Creates a new context suitable for this template.
|
static void |
dumpAndXMLQuoteUTF8(com.yahoo.io.ByteWriter writer,
byte[] utf)
Deprecated.
Dump UTF-8 byte array to writer, but escape low ASCII codes except
TAB, NL and CR, and escape ampersand, less than and greater than.
|
static boolean |
dumpBytes(com.yahoo.io.ByteWriter writer,
FastHit hit,
String fieldName)
Deprecated.
If the field is available as a UTF-8 byte array,
dump it to the writer.
|
abstract void |
error(Context context,
T writer)
Deprecated.
Render the error message for a result set.
|
abstract void |
footer(Context context,
T writer)
Deprecated.
Render the result set footer.
|
abstract void |
header(Context context,
T writer)
Deprecated.
Render the result set header.
|
abstract void |
hit(Context context,
T writer)
Deprecated.
Render a single top level hit.
|
abstract void |
hitFooter(Context context,
T writer)
Deprecated.
Render a footer for a single top level hit.
|
boolean |
isDefaultTemplateSet()
Deprecated.
For internal use only
TODO: get rid of this method *
|
abstract void |
noHits(Context context,
T writer)
Deprecated.
Invoked when the result set has no hits.
|
void |
queryContext(Context context,
T writer)
Deprecated.
Override this to add custom rendering for the query context of the result.
|
private static void |
quoteByte(com.yahoo.io.ByteWriter writer,
byte b)
Deprecated.
|
T |
wrapWriter(Writer writer)
Deprecated.
This is called once before each result is rendered using this template.
|
getBoldCloseTag, getBoldOpenTag, getEncoding, getMimeType, getName, getRequestedEncoding, getSeparatorTag, getSummaryClass, getTemplate, setHighlightTags, setSummaryClass, setTemplate, setTemplateNotNull
private static final byte[] ampersand
private static final byte[] lessThan
private static final byte[] greaterThan
private static final byte[] quotePrefix
private static final Logger log
public UserTemplate(String name, String mimeType, String encoding)
public UserTemplate(String name)
public T wrapWriter(Writer writer)
public Context createContext()
public boolean isDefaultTemplateSet()
public abstract void header(Context context, T writer) throws IOException
The result set is available in the context object under the name "result".
context
- wrapper which will contain, among other thing, the result
set instancewriter
- the destination for rendering the resultIOException
- may be propagated from the writerpublic abstract void footer(Context context, T writer) throws IOException
The result set is available in the context object under the name "result".
context
- wrapper which will contain, among other thing, the result
set instancewriter
- the destination for rendering the resultIOException
- may be propagated from the writerpublic abstract void hit(Context context, T writer) throws IOException
The result set is available in the context object under the name "result". The hit itself as "hit", the index of the hit as "hitno", and all the fields under their normal names.
context
- wrapper which will contain, among other thing, the hit
instancewriter
- the destination for rendering the hitIOException
- may be propagated from the writerpublic abstract void hitFooter(Context context, T writer) throws IOException
The result set is available in the context object under the name "result". The hit itself as "hit", the index of the hit as "hitno", and all the fields under their normal names.
context
- wrapper which will contain, among other thing, the hit
instancewriter
- the destination for rendering the hitIOException
- may be propagated from the writerpublic abstract void error(Context context, T writer) throws IOException
The result set is available in the context object under the name "result".
context
- wrapper which will contain, among other thing, main error
and result set instances.writer
- the destination for rendering the hitIOException
- may be propagated from the writerpublic abstract void noHits(Context context, T writer) throws IOException
The result set is available in the context object under the name "result".
context
- wrapper which will contain, among other thing, the result
set instancewriter
- the destination for rendering the hitIOException
- may be propagated from the writerpublic void queryContext(Context context, T writer) throws IOException
The result set is available in the context object under the name "result". The query context is retrieved from the result by calling result.getQuery.getContext(false)
context
- wrapper which will contain, among other things, the result
set instancewriter
- the destination for rendering the hitIOException
- may be propagated from the writerpublic static void dumpAndXMLQuoteUTF8(com.yahoo.io.ByteWriter writer, byte[] utf) throws IOException
It is presumed the writer is buffered (which is the case in normal result rendering), as the method may perform a large number of write operations.
public only for testing.
IOException
public static boolean dumpBytes(com.yahoo.io.ByteWriter writer, FastHit hit, String fieldName) throws IOException
IOException
private static void quoteByte(com.yahoo.io.ByteWriter writer, byte b) throws IOException
IOException
Copyright © 2018. All rights reserved.