public interface Slug
A slug is a so called 'static' or 'Clean URL' or 'Pretty URL' or 'nice-looking URL' or 'Speaking URL' or 'user-friendly URL' or 'SEO-friendly URL' from a string. This module aims to transliterate the input string.
The implementation is thread safe because the state of the slug is not stored in fields. Except of the options, but
they are immutable. That's the reason why you must use a builder
to configure and create a slug.
Modifier and Type | Interface and Description |
---|---|
static class |
Slug.Builder
Builder to configure and create the
slugger . |
Modifier and Type | Method and Description |
---|---|
String |
get(String input)
Generates a slug from given input string.
|
String |
get(String input,
String separator)
Generates a slug from given input string with custom separator.
|
Map<String,String> |
getCustom()
Get the custom mapping option.
|
Language |
lang()
Get the language option.
|
boolean |
maintainCase()
Get the maintain case option.
|
boolean |
mark()
Get the mark option.
|
String |
separator()
Get the separator option.
|
boolean |
titleCase()
Get the title case option.
|
Set<String> |
titleCaseExclude()
Get the title case excludes option.
|
int |
truncate()
Get the truncate length option.
|
boolean |
uric()
Get the URI characters option.
|
boolean |
uricNoSlash()
Get the URI characters without slash option.
|
String get(String input)
input
- may be null
or emptynull
, may be emptyString get(String input, String separator)
This method overwrites the separator configured by Slug.Builder.separator(java.lang.String)
.
input
- may be null
or emptyseparator
- must not be null
null
, may be emptyString separator()
null
Language lang()
null
boolean maintainCase()
boolean titleCase()
Set<String> titleCaseExclude()
null
int truncate()
boolean uric()
boolean uricNoSlash()
boolean mark()
Copyright © 2012 Sven Strittmatter. All Rights Reserved.