Class ConfigReferenceParser
java.lang.Object
tech.guilhermekaua.spigotboot.config.reference.ConfigReferenceParser
Parses config reference tokens from string values.
Reference syntax:
${configName}- single config root${configName:path.to.value}- single config with path${folderConfigName.itemId}- folder config item root${folderConfigName.itemId:path.to.value}- folder config item with path
Names (configName, folderConfigName, itemId) must match [a-zA-Z0-9_-]+.
Names cannot contain '.' or ':' as these are used as delimiters.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisValidName(@NotNull String name) Validates that a name is valid for use in references.booleanlooksLikeReference(@NotNull String value) Checks if a string value looks like a reference token.@NotNull Optional<ConfigReference>Attempts to parse a string value as a config reference.
-
Constructor Details
-
ConfigReferenceParser
public ConfigReferenceParser()
-
-
Method Details
-
tryParse
Attempts to parse a string value as a config reference.Only parses if the entire value is exactly a reference token (no interpolation).
- Parameters:
value- the string value to parse- Returns:
- the parsed reference, or empty if not a valid reference
-
looksLikeReference
Checks if a string value looks like a reference token.This is a quick check that doesn't validate the full syntax.
- Parameters:
value- the value to check- Returns:
- true if it looks like a reference
-
isValidName
Validates that a name is valid for use in references.Valid names contain only letters, digits, underscores, and hyphens. Names cannot contain '.' or ':' as these are delimiter characters.
- Parameters:
name- the name to validate- Returns:
- true if valid
-