Class SlugServiceImpl
java.lang.Object
com.example.blogs.app.api.post.service.SlugServiceImpl
- All Implemented Interfaces:
SlugService
Generates unique URL-friendly slugs by combining slugified titles with random suffixes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGenerates a unique slug from a title with appended suffix.Generates a random unique suffix for slug uniqueness.
-
Constructor Details
-
SlugServiceImpl
public SlugServiceImpl()
-
-
Method Details
-
generateSuffix
Description copied from interface:SlugServiceGenerates a random unique suffix for slug uniqueness.- Specified by:
generateSuffixin interfaceSlugService- Returns:
- 12-character random suffix
-
generate
Description copied from interface:SlugServiceGenerates a unique slug from a title with appended suffix.- Specified by:
generatein interfaceSlugService- Parameters:
title- the title to convert to slug- Returns:
- URL-friendly slug with unique suffix
-