Interface IRenderer
-
public interface IRenderer
The common interface of all renderers.Note that this interface does not enforce type-safety through generic type parameters. This reflects it's main usage in the web context as well as Java type erasure.
So renderers are required to check types at runtime and to throw adequate exceptions.
Default rendering parameters (setParam)
PARAM_DEFAULT_OUTPUT
(de.uplanet.lucy.server.renderer.defaultOutput)
this value is returned if the rendering value was empty, (not used in a pipe)PARAM_ERROR_MODE
(default:exceptionThrow
)
(de.uplanet.lucy.server.renderer.errorMode)
Error mode, valid values: (value of enum classIRenderer.ErrorMode
)exceptionThrow
, throws a Renderer Exception, if an error occurserrorMsg
, returns the error value given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, when the input value is not castable or not parseableerrorMsgOnCast
, returns the error value given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, when the input value is not castableerrorMsgOnParse
, returns the error value, given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, when the input value is not parseable
PARAM_ERROR_MSG
(default:""
)
(de.uplanet.lucy.server.renderer.IRenderer.errorMsg)
Text will be returned ifPARAM_ERRORMODE=errorMsg
and an error occurs.PARAM_JAVASCRIPT_ENCODE
(default:false
)
(de.uplanet.lucy.server.renderer.IRenderer.javaScriptEncode)
Text will be encoded for use in JavaScript context.PARAM_HTML_ENCODE
(default:false
)
(de.uplanet.lucy.server.renderer.IRenderer.htmlEncode)
Text will be encoded for use in HTML context.PARAM_HTML_BR_INSERT
(de.uplanet.lucy.server.renderer.IRenderer.htmlBRInsert)
CRLF, CR or LF will replaced by <br> .
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
IRenderer.ErrorMode
-
Field Summary
Fields Modifier and Type Field Description static String
PARAM_DEFAULT_OUTPUT
Thede.uplanet.lucy.server.renderer.IRenderer.defaultOutput
property specifies the output that's generated by the renderer if no input data are provided.static String
PARAM_ERROR_MODE
Error mode, valid values: value of enum classIRenderer.ErrorMode
(default:exceptionThrow
)
exceptionThrow
, throw aRendererException
iif an error occurserrorMsg
, returns the error value, given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, when the input value is not castable or not parseable.errorMsgOnCast
, returns the error value, given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, when the input value is not castable.errorMsgOnParse
, returns the error value, given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, if the input value is not parseable.static String
PARAM_ERROR_MSG
de.uplanet.lucy.server.renderer.IRenderer.errorMsg
static String
PARAM_HTML_BR_INSERT
de.uplanet.lucy.server.renderer.IRenderer.htmlBRInsert
static String
PARAM_HTML_ENCODE
de.uplanet.lucy.server.renderer.IRenderer.htmlEncode
static String
PARAM_JAVASCRIPT_ENCODE
de.uplanet.lucy.server.renderer.IRenderer.javaScriptEncode
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getOutput(IValueHolder<?> p_vh)
Get the rendered results as a string.void
setParam(String p_strName, Object p_value)
Set a renderer parameter.void
writeOutput(de.uplanet.lucy.server.renderer.IPipedRenderer p_child, IValueHolder<?> p_vh)
Write the rendered results to the given child renderer.void
writeOutput(Writer p_out, IValueHolder<?> p_vh)
Write the rendered results to the given output stream.
-
-
-
Field Detail
-
PARAM_DEFAULT_OUTPUT
static final String PARAM_DEFAULT_OUTPUT
Thede.uplanet.lucy.server.renderer.IRenderer.defaultOutput
property specifies the output that's generated by the renderer if no input data are provided.The default value for this property is the empty string.
-
PARAM_ERROR_MODE
static final String PARAM_ERROR_MODE
Error mode, valid values: value of enum classIRenderer.ErrorMode
(default:exceptionThrow
)
exceptionThrow
, throw aRendererException
iif an error occurserrorMsg
, returns the error value, given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, when the input value is not castable or not parseable.errorMsgOnCast
, returns the error value, given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, when the input value is not castable.errorMsgOnParse
, returns the error value, given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, if the input value is not parseable.
-
PARAM_ERROR_MSG
static final String PARAM_ERROR_MSG
de.uplanet.lucy.server.renderer.IRenderer.errorMsg
default: ""
Text will return if
PARAM_ERRORMODE == errorMsg
and an error occurred.
-
PARAM_JAVASCRIPT_ENCODE
static final String PARAM_JAVASCRIPT_ENCODE
de.uplanet.lucy.server.renderer.IRenderer.javaScriptEncode
-
PARAM_HTML_ENCODE
static final String PARAM_HTML_ENCODE
de.uplanet.lucy.server.renderer.IRenderer.htmlEncode
-
PARAM_HTML_BR_INSERT
static final String PARAM_HTML_BR_INSERT
de.uplanet.lucy.server.renderer.IRenderer.htmlBRInsert
-
-
Method Detail
-
writeOutput
void writeOutput(Writer p_out, IValueHolder<?> p_vh) throws de.uplanet.lucy.server.renderer.RendererException, IOException
Write the rendered results to the given output stream.If the given value holder provides a
Closeable
data object, the renderer will call theclose()
method if it uses it.- Parameters:
p_out
- The output stream.p_vh
- The value to be rendered.- Throws:
de.uplanet.lucy.server.renderer.RendererException
- - If an error occurred. This exception may wrap other exceptions that occurred while rendering the input.IOException
- - If an I/O error occurred.
-
writeOutput
void writeOutput(de.uplanet.lucy.server.renderer.IPipedRenderer p_child, IValueHolder<?> p_vh) throws de.uplanet.lucy.server.renderer.RendererException, IOException
Write the rendered results to the given child renderer.If the given value holder provides a
Closeable
data object, the renderer will call theclose()
method if it uses it.- Parameters:
p_child
- The child renderer.p_vh
- The value to be rendered.- Throws:
de.uplanet.lucy.server.renderer.RendererException
- - If an error occurred. This exception may wrap other exceptions that occurred while rendering the input.IOException
- - If an I/O error occurred.
-
getOutput
String getOutput(IValueHolder<?> p_vh) throws de.uplanet.lucy.server.renderer.RendererException
Get the rendered results as a string.If the given value holder provides a
Closeable
data object, the renderer will call theclose()
method if it uses it.- Parameters:
p_vh
- The value to be rendered.- Returns:
- The rendered value.
- Throws:
de.uplanet.lucy.server.renderer.RendererException
- - If an error occurred. This exception may wrap other exceptions that occurred while rendering the input.
-
-