public final class Keyword extends Object implements Comparable<Keyword>
A Keyword can be presented in the different ways: * CamelCaseStyle * underscore_style * CONSTANT_STYLE * dash-style * “readable style” * “Http-Header-Style”
When reading a string into a keyword, the following separator chars will be ignored and used as separator to construct the keyword
' '_-,.:;\/| Modifier and Type | Class and Description |
|---|---|
static class |
Keyword.F |
static class |
Keyword.Style |
| Modifier and Type | Field and Description |
|---|---|
static Keyword |
NULL |
static char |
SEP_COLON |
static char |
SEP_COMMA |
static char |
SEP_DASH |
static char |
SEP_DOT |
static char |
SEP_FORWARD_SLASH |
static char |
SEP_SEMI_COLON |
static char |
SEP_SLASH |
static char |
SEP_SPACE |
static char |
SEP_UNDERSCORE |
| Constructor and Description |
|---|
Keyword(CharSequence chars) |
| Modifier and Type | Method and Description |
|---|---|
String |
acronym() |
String |
camelCase()
The
UpperCamelCase style |
int |
compareTo(Keyword o) |
String |
constantName() |
boolean |
contains(Keyword keyword)
Check if specified keyword is sub sequence of this keyword.
|
boolean |
contains(String string) |
String |
dashed()
Returns hyphen separated string.
|
String |
dotted() |
boolean |
endsWith(Keyword keyword)
Check if specified keyword equals to or is suffix of this keyword.
|
boolean |
endsWith(String string) |
static boolean |
eq(CharSequence a,
CharSequence b)
Check if two
CharSequences are keyword identical. |
static boolean |
equals(CharSequence a,
CharSequence b)
Check if two
CharSequences are keyword identical. |
boolean |
equals(Object obj) |
int |
hashCode() |
String |
httpHeader() |
String |
hyphenated()
Alias of
dashed() |
String |
javaVariable()
The
lowerCamelCase style |
String |
kebabCase()
Alias of
dashed() |
String |
lowerCamelCase()
Alias of
javaVariable() |
boolean |
matches(CharSequence charSequence) |
boolean |
matches(Keyword keyword) |
static boolean |
neq(CharSequence a,
CharSequence b)
Check if two
CharSequences are not keyword identical. |
static boolean |
notEquals(CharSequence a,
CharSequence b)
Check if two
CharSequences are not keyword identical. |
static Keyword |
of(CharSequence chars)
Create a
Keyword for the given chars |
String |
pascalCase()
Alias of
camelCase(). |
String |
readable() |
String |
snakeCase()
Alias of
underscore() |
String |
startCase() |
boolean |
startsWith(Keyword keyword)
Check if specified keyword equals to or is prefix of this keyword.
|
boolean |
startsWith(String string) |
List<String> |
tokens() |
String |
toString()
Returns string representation of this keyword using
underscore style |
String |
toString(Keyword.Style style)
Return string representation of this keyword using style specified
|
String |
underscore() |
String |
upperCamelCase()
Alias of
camelCase(). |
public static final Keyword NULL
public static final char SEP_SPACE
public static final char SEP_UNDERSCORE
public static final char SEP_DASH
public static final char SEP_COMMA
public static final char SEP_COLON
public static final char SEP_DOT
public static final char SEP_SEMI_COLON
public static final char SEP_SLASH
public static final char SEP_FORWARD_SLASH
public Keyword(CharSequence chars)
public boolean matches(CharSequence charSequence)
public boolean matches(Keyword keyword)
public String acronym()
public String camelCase()
The UpperCamelCase style
public String upperCamelCase()
Alias of camelCase().
public String pascalCase()
Alias of camelCase().
public String javaVariable()
The lowerCamelCase style
public String lowerCamelCase()
Alias of javaVariable()
public String constantName()
public String underscore()
public String snakeCase()
Alias of underscore()
public String dashed()
Returns hyphen separated string.
public String dotted()
public String httpHeader()
public String startCase()
public String readable()
public String toString()
Returns string representation of this keyword using underscore style
public String toString(Keyword.Style style)
Return string representation of this keyword using style specified
style - the style used to print this keywordpublic boolean contains(Keyword keyword)
Check if specified keyword is sub sequence of this keyword.
keyword - the keyword to checktrue if the keyword specified is sub sequence of this keywordpublic boolean contains(String string)
public boolean startsWith(Keyword keyword)
Check if specified keyword equals to or is prefix of this keyword.
keyword - the keyword to checktrue if this keyword starts with the specified keywordpublic boolean startsWith(String string)
public boolean endsWith(Keyword keyword)
Check if specified keyword equals to or is suffix of this keyword.
keyword - the keyword to checktrue if this keyword ends with the specified keywordpublic boolean endsWith(String string)
public int compareTo(Keyword o)
compareTo in interface Comparable<Keyword>public static Keyword of(CharSequence chars)
Create a Keyword for the given chars
chars - A CharSequenceKeyword of the charspublic static boolean eq(CharSequence a, CharSequence b)
Check if two CharSequences are keyword identical.
This method is an alias of equals(CharSequence, CharSequence).
a - the first char sequenceb - the second char sequencetrue if a and b are keyword identicalpublic static boolean neq(CharSequence a, CharSequence b)
Check if two CharSequences are not keyword identical.
a - the first char sequenceb - the second char sequencetrue if a and b are not keyword identicalpublic static boolean equals(CharSequence a, CharSequence b)
Check if two CharSequences are keyword identical.
This method is an alias of notEquals(CharSequence, CharSequence).
a - the first char sequenceb - the second char sequencetrue if a and b are keyword identicalpublic static boolean notEquals(CharSequence a, CharSequence b)
Check if two CharSequences are not keyword identical.
a - the first char sequenceb - the second char sequencetrue if a and b are not keyword identicalCopyright © 2014–2019 OSGL (Open Source General Library). All rights reserved.