Package dev.zucca_ops.kustomtrace.parser
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.
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:
- Identifying that the reference targets a directory.
- 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()).
- Listing files within the directory (e.g., for
- Ultimately, streaming
Pathobjects that point to the individual, resolved *files*.
-
Method Summary
-
Method Details
-
extract
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 theyamlFieldValueshould be resolved.- Returns:
- A
Streamof resolvedPathobjects, 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 theyamlFieldValueis malformed, contains invalid path strings, or refers to resources that cannot be properly resolved according to the extractor's specific logic.
-