Package dev.zucca_ops.kustomtrace.parser
Enum Class ReferenceType
- All Implemented Interfaces:
Serializable,Comparable<ReferenceType>,Constable
Defines the different types of Kustomize fields that can contain references
to other resources or Kustomization files.
Each enum constant is associated with a specific YAML key found in Kustomization files
and a ReferenceExtractor strategy responsible for parsing the value of that key
to extract and resolve file paths.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionExtracts and resolves file paths from the given YAML value using theReferenceExtractorassociated with this reference type.static ReferenceTypefromYamlKey(String key) Retrieves aReferenceTypeenum constant based on its YAML key.getRawReferences(Map<String, Object> kustomizationContentMap) Retrieves raw reference values from a Kustomization content map for this reference type.Gets the YAML key string associated with this reference type (e.g., "resources", "bases").static BooleanisReferenceKey(String key) Checks if a given YAML key corresponds to a knownReferenceType.static ReferenceTypeReturns the enum constant of this class with the specified name.static ReferenceType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
RESOURCE
-
BASE
-
COMPONENT
-
PATCH
-
PATCH_MERGE
-
CONFIG_MAP
-
SECRET
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getYamlKey
Gets the YAML key string associated with this reference type (e.g., "resources", "bases").- Returns:
- The YAML key.
-
extract
Extracts and resolves file paths from the given YAML value using theReferenceExtractorassociated with this reference type. HandlesInvalidReferenceExceptionfrom the extractor by logging and returning an empty stream.- Parameters:
yamlValue- The raw value associated with this reference type's key, obtained from the parsed Kustomization YAML content.baseDir- The base directory for resolving relative paths found in the yamlValue.- Returns:
- A
Streamof resolvedPathobjects. Returns an empty stream if extraction fails or no valid references are found.
-
getRawReferences
Retrieves raw reference values from a Kustomization content map for this reference type. Expects the value associated withgetYamlKey()to be a List.- Parameters:
kustomizationContentMap- The parsed content of a Kustomization file.- Returns:
- A stream of objects from the list, or an empty stream if the key is absent or its value is not a list.
-
fromYamlKey
Retrieves aReferenceTypeenum constant based on its YAML key.- Parameters:
key- The YAML key string (e.g., "resources", "bases").- Returns:
- The corresponding
ReferenceType, or null if no match is found.
-
isReferenceKey
Checks if a given YAML key corresponds to a knownReferenceType.- Parameters:
key- The YAML key string.- Returns:
- True if the key is a known reference type, false otherwise.
-