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")
    )
    • 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-")

      • 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