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 class IRenderer.ErrorMode)
    • exceptionThrow, throws a Renderer Exception, if an error occurs
    • errorMsg, returns the error value given by the de.uplanet.lucy.server.renderer.IRenderer.errorMsg parameter, when the input value is not castable or not parseable
    • errorMsgOnCast, returns the error value given by the de.uplanet.lucy.server.renderer.IRenderer.errorMsg parameter, when the input value is not castable
    • errorMsgOnParse, returns the error value, given by the de.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 if PARAM_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> .
  • Field Details

    • PARAM_DEFAULT_OUTPUT

      static final String PARAM_DEFAULT_OUTPUT
      The de.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 class IRenderer.ErrorMode
      (default: exceptionThrow)

    • 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 Details

    • 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 the close() 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 the close() 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 the close() 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.
    • setParam

      void setParam(String p_strName, Object p_value) throws de.uplanet.lucy.server.renderer.RendererException
      Set a renderer parameter.
      Parameters:
      p_strName - The name of the parameter.
      p_value - The value of the parameter.
      Throws:
      de.uplanet.lucy.server.renderer.RendererException