Class RenderableEntry
- java.lang.Object
-
- io.virtdata.docsys.metafs.fs.renderfs.api.RenderableEntry
-
- All Implemented Interfaces:
Renderable,Versioned,java.util.function.Function<TargetPathView,java.nio.ByteBuffer>
public class RenderableEntry extends java.lang.Object implements Renderable
-
-
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.ByteBufferapply(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.longgetVersion()Get the version for this element.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.virtdata.docsys.metafs.fs.renderfs.api.Versioned
isValidFor, isValidFor
-
-
-
-
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 datacompiler- 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 entrycompiler- 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:
getVersionin interfaceVersioned
-
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:- 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.
- Specified by:
applyin interfacejava.util.function.Function<TargetPathView,java.nio.ByteBuffer>- Parameters:
targetPathView-- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-