Class ExternalIconConfig
-
- All Implemented Interfaces:
-
io.github.kingsword09.symbolcraft.model.IconConfig
@Serializable() public final class ExternalIconConfig implements IconConfig
Configuration for external icon libraries with URL template support.
Supports flexible URL patterns with placeholder replacement.
Available placeholders:
{name}: Icon name
{key}: Any custom style parameter key
Example:
ExternalIconConfig( libraryName = "bootstrap-icons", urlTemplate = "https://esm.sh/bootstrap-icons/{style}/{name}.svg", styleParams = mapOf("style" to "fill") )
-
-
Field Summary
Fields Modifier and Type Field Description private final StringlibraryIdprivate final StringlibraryNameprivate final StringurlTemplateprivate final Map<String, String>styleParams
-
Method Summary
Modifier and Type Method Description StringgetLibraryId()Unique identifier for the icon library. final StringgetLibraryName()Name of the external library (will be prefixed with "external-") final StringgetUrlTemplate()URL pattern with placeholders (must be full URL) final Map<String, String>getStyleParams()Map of style parameters for placeholder replacement StringbuildUrl(String iconName)Build the CDN URL for downloading the icon SVG file. StringgetCacheKey(String iconName)Generate a unique cache key for this icon and configuration combination. StringgetSignature()Generate a signature string used for file naming. -
-
Method Detail
-
getLibraryId
String getLibraryId()
Unique identifier for the icon library. Must be unique across all icon libraries to avoid cache conflicts.
Recommended format: "library-name" (e.g., "material-symbols", "font-awesome")
-
getLibraryName
final String getLibraryName()
Name of the external library (will be prefixed with "external-")
-
getUrlTemplate
final String getUrlTemplate()
URL pattern with placeholders (must be full URL)
-
getStyleParams
final Map<String, String> getStyleParams()
Map of style parameters for placeholder replacement
-
buildUrl
String buildUrl(String iconName)
Build the CDN URL for downloading the icon SVG file.
- Parameters:
iconName- Name of the icon (e.g.- Returns:
Full URL to the SVG file
-
getCacheKey
String getCacheKey(String iconName)
Generate a unique cache key for this icon and configuration combination.
The cache key MUST be unique across all icons and configurations to avoid cache conflicts. It's recommended to include: iconName, libraryId, and all style parameters.
- Parameters:
iconName- Name of the icon- Returns:
Unique cache key string
-
getSignature
String getSignature()
Generate a signature string used for file naming. This appears in the generated Kotlin file names.
Should be short and descriptive (e.g., "W400Outlined", "Fill", "24px")
- Returns:
Signature string for file naming
-
-
-
-