Class TemplatedObjectReader

java.lang.Object
dev.enola.common.io.object.template.TemplatedObjectReader
All Implemented Interfaces:
ObjectReader

public class TemplatedObjectReader extends Object implements ObjectReader
An ObjectReader that first processes a resource as a template.

It reads a resource, parses it as a Map to be used as a model, then treats the original resource content as a template, applies the model to it, and finally delegates parsing of the resulting content to another ObjectReader.

This allows for self-referential templates, where values defined in a file (e.g. YAML) can be used in other parts of the same file.

NOTE: This implementation reads the entire resource into memory to perform templating. It is not suitable for very large resources.