Interface ReferenceExtractor

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ReferenceExtractor
A functional interface for strategies that extract and resolve file path references from a given value, typically found within a Kustomization file's parsed content.

**Implementation Responsibility:** Implementations of this interface are responsible for interpreting the yamlFieldValue and resolving it to a stream of concrete Paths.

If a Kustomize reference points to a directory (e.g., resources: [../my-app-dir]), the extractor for that reference type is responsible for:

  1. Identifying that the reference targets a directory.
  2. Performing any necessary operations based on that directory, such as:
    • Listing files within the directory (e.g., for resourceOrDirectory()).
    • Locating a specific kustomization definition file (e.g., "kustomization.yaml") within that directory (e.g., for kustomizationFile()).
  3. Ultimately, streaming Path objects that point to the individual, resolved *files*.
  • Method Summary

    Modifier and Type
    Method
    Description
    extract(Object yamlFieldValue, Path baseDir)
    Extracts and resolves file paths from a given YAML field value.
  • Method Details

    • extract

      Stream<Path> extract(Object yamlFieldValue, Path baseDir) throws InvalidReferenceException
      Extracts and resolves file paths from a given YAML field value.
      Parameters:
      yamlFieldValue - The value of the field from the parsed YAML content (e.g., a String, List, or Map).
      baseDir - The base directory against which relative paths in the yamlFieldValue should be resolved.
      Returns:
      A Stream of resolved Path objects, each pointing to a specific file. Returns an empty stream if no valid references are found or if the input value is not applicable.
      Throws:
      InvalidReferenceException - If the yamlFieldValue is malformed, contains invalid path strings, or refers to resources that cannot be properly resolved according to the extractor's specific logic.