Class RenderableEntry

    • Constructor Summary

      Constructors 
      Constructor Description
      RenderableEntry​(RenderableEntry upstream, TemplateCompiler compiler)
      Create a renderable entry which receives its template image from another renderable entry.
      RenderableEntry​(java.util.function.Supplier<java.nio.ByteBuffer> bufferSource, TemplateCompiler compiler)
      Create a renderable entry which receives its template image from a direct byte buffer source.
    • Method Summary

      Modifier and Type Method Description
      java.nio.ByteBuffer apply​(TargetPathView targetPathView)
      Create a rendered document image of some type (it might not always be html, for example) by doing the following: Read the template image unless it is already valid. Construct a new renderer from the template image. Construct a new document image with the renderer. Update the version. Return the document image to the reader. These steps are only taken if needed.
      long getVersion()
      Get the version for this element.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.function.Function

        andThen, compose
    • Constructor Detail

      • RenderableEntry

        public RenderableEntry​(java.util.function.Supplier<java.nio.ByteBuffer> bufferSource,
                               TemplateCompiler compiler)
        Create a renderable entry which receives its template image from a direct byte buffer source. When this entry is accessed, its validity (version) will be checked against the version of the viewed path. If it needs to be re-rendered, then the template image will be re-read from the buffer source.
        Parameters:
        bufferSource - a direct source of byte buffer data
        compiler - the template compiler for this entry
      • RenderableEntry

        public RenderableEntry​(RenderableEntry upstream,
                               TemplateCompiler compiler)
        Create a renderable entry which receives its template image from another renderable entry. When this entry's version is invalid with respect to the upstream entry's version, then this entry will be recomputed on access by first asking for an updated template image from upstream.
        Parameters:
        upstream - The upstream renderable entry
        compiler - The template compiler for this entry
    • Method Detail

      • getVersion

        public long getVersion()
        Get the version for this element. An element is considered valid only for other elements of the same version.
        Specified by:
        getVersion in interface Versioned
      • apply

        public java.nio.ByteBuffer apply​(TargetPathView targetPathView)
        Create a rendered document image of some type (it might not always be html, for example) by doing the following:
        1. Read the template image unless it is already valid.
        2. Construct a new renderer from the template image.
        3. Construct a new document image with the renderer.
        4. Update the version.
        5. Return the document image to the reader.
        These steps are only taken if needed. When the version matches the previously read version of this element, then only the last step is taken.
        Specified by:
        apply in interface java.util.function.Function<TargetPathView,​java.nio.ByteBuffer>
        Parameters:
        targetPathView -
        Returns:
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object