Class MapTemplateSource
java.lang.Object
network.ike.plugin.scaffold.MapTemplateSource
- All Implemented Interfaces:
TemplateSource
In-memory
TemplateSource backed by a Map<String,
byte[]>. Intended for tests and callers that synthesize templates
programmatically.-
Constructor Summary
ConstructorsConstructorDescriptionMapTemplateSource(Map<String, byte[]> templates) Construct a source backed by the given map. -
Method Summary
-
Constructor Details
-
MapTemplateSource
Construct a source backed by the given map. Lookups return a defensive copy of the stored bytes, but the map itself is kept by reference for efficiency.- Parameters:
templates- map from source path to template bytes; the map is kept by reference, so callers must not mutate it after construction
-
-
Method Details
-
ofStrings
Convenience factory for a string-valued map.- Parameters:
templates- map from source path to template text (UTF-8)- Returns:
- a
MapTemplateSource
-
read
Description copied from interface:TemplateSourceRead template bytes for a given source path.- Specified by:
readin interfaceTemplateSource- Parameters:
source- the path declared in the manifest'ssourcefield- Returns:
- the template bytes
-