Class NamingConfig
-
- All Implemented Interfaces:
public abstract class NamingConfigConfiguration for icon naming transformation.
Provides both preset methods and fine-grained control over naming conventions.
Example:
symbolCraft { naming { pascalCase(suffix = "Icon") // Preset // Or customize: namingConvention.set(NamingConvention.PASCAL_CASE) suffix.set("Icon") // Or use custom transformer: customTransformer(object : IconNameTransformer() { override fun transform(fileName: String): String { return fileName.uppercase() + "Icon" } }) } }
-
-
Field Summary
Fields Modifier and Type Field Description private final Property<NamingConvention>namingConventionprivate final Property<String>suffixprivate final Property<String>prefixprivate final Property<String>removePrefixprivate final Property<String>removeSuffixprivate final Property<IconNameTransformer>transformer
-
Constructor Summary
Constructors Constructor Description NamingConfig(ObjectFactory objects)
-
Method Summary
Modifier and Type Method Description abstract Property<NamingConvention>getNamingConvention()Naming convention to apply (e.g., PASCAL_CASE, CAMEL_CASE). abstract Property<String>getSuffix()Suffix to append to generated class names (e.g., "Icon" → HomeIcon). abstract Property<String>getPrefix()Prefix to prepend to generated class names (e.g., "Ic" → IcHome). abstract Property<String>getRemovePrefix()Prefix to remove from input file names before transformation (e.g., "ic_"). abstract Property<String>getRemoveSuffix()Suffix to remove from input file names before transformation (e.g., "_24dp"). abstract Property<IconNameTransformer>getTransformer()Custom transformer that takes full control of naming. final UnitpascalCase(String suffix, String prefix)Apply PascalCase convention with optional suffix/prefix. final UnitcamelCase(String suffix, String prefix)Apply camelCase convention with optional suffix/prefix. final UnitsnakeCase(Boolean uppercase)Apply snake_case or SCREAMING_SNAKE_CASE convention. final UnitkebabCase()Apply kebab-case convention. final UnitlowerCase()Apply lowercase convention (removes all special characters). final UnitupperCase()Apply UPPERCASE convention (removes all special characters). final UnitcustomTransformer(IconNameTransformer transformer)Provide a custom transformer. -
-
Method Detail
-
getNamingConvention
abstract Property<NamingConvention> getNamingConvention()
Naming convention to apply (e.g., PASCAL_CASE, CAMEL_CASE).
-
getSuffix
abstract Property<String> getSuffix()
Suffix to append to generated class names (e.g., "Icon" → HomeIcon).
-
getPrefix
abstract Property<String> getPrefix()
Prefix to prepend to generated class names (e.g., "Ic" → IcHome).
-
getRemovePrefix
abstract Property<String> getRemovePrefix()
Prefix to remove from input file names before transformation (e.g., "ic_").
-
getRemoveSuffix
abstract Property<String> getRemoveSuffix()
Suffix to remove from input file names before transformation (e.g., "_24dp").
-
getTransformer
abstract Property<IconNameTransformer> getTransformer()
Custom transformer that takes full control of naming. When set, this overrides convention-based transformation.
-
pascalCase
final Unit pascalCase(String suffix, String prefix)
Apply PascalCase convention with optional suffix/prefix.
Example: home-icon → HomeIcon (with suffix = "Icon")
- Parameters:
suffix- Optional suffix to append (e.g.prefix- Optional prefix to prepend (e.g.
-
camelCase
final Unit camelCase(String suffix, String prefix)
Apply camelCase convention with optional suffix/prefix.
Example: home-icon → homeIcon (with prefix = "ic" → icHomeIcon)
- Parameters:
suffix- Optional suffix to appendprefix- Optional prefix to prepend (e.g.
-
snakeCase
final Unit snakeCase(Boolean uppercase)
Apply snake_case or SCREAMING_SNAKE_CASE convention.
Example:
home-icon → home_icon (uppercase = false)
home-icon → HOME_ICON (uppercase = true)
- Parameters:
uppercase- If true, uses SCREAMING_SNAKE_CASE
-
lowerCase
final Unit lowerCase()
Apply lowercase convention (removes all special characters).
Example: Home-Icon → homeicon
-
upperCase
final Unit upperCase()
Apply UPPERCASE convention (removes all special characters).
Example: home-icon → HOMEICON
-
customTransformer
final Unit customTransformer(IconNameTransformer transformer)
Provide a custom transformer.
This gives you full control over the naming logic and overrides convention-based transformation.
Example:
naming { customTransformer(object : IconNameTransformer() { override fun transform(fileName: String): String { return fileName.removePrefix("ic_").capitalize() + "Icon" } }) }- Parameters:
transformer- Custom IconNameTransformer instance
-
-
-
-