Class MapTemplateSource

java.lang.Object
network.ike.plugin.scaffold.MapTemplateSource
All Implemented Interfaces:
TemplateSource

public final class MapTemplateSource extends Object implements TemplateSource
In-memory TemplateSource backed by a Map<String, byte[]>. Intended for tests and callers that synthesize templates programmatically.
  • Constructor Details

    • MapTemplateSource

      public MapTemplateSource(Map<String,byte[]> templates)
      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

      public static MapTemplateSource ofStrings(Map<String,String> templates)
      Convenience factory for a string-valued map.
      Parameters:
      templates - map from source path to template text (UTF-8)
      Returns:
      a MapTemplateSource
    • read

      public byte[] read(String source)
      Description copied from interface: TemplateSource
      Read template bytes for a given source path.
      Specified by:
      read in interface TemplateSource
      Parameters:
      source - the path declared in the manifest's source field
      Returns:
      the template bytes