|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.legstar.coxb.util.NameUtil
public final class NameUtil
Utilities that are common to the binding API and dependents.
Part of this code is more or less a clone of Sun's
com.sun.xml.bind.api.impl.NameUtil
.
It's just that dragging the entire jaxb-impl as a dependency just to get the
naming right is overkill.
The jaxb-impl dependency is a real pain since it is now included in JRE and
brings in all forms of version conflicts.
Method Summary | ||
---|---|---|
static String |
capitalize(String s)
Capitalizes the first character of the specified string, and de-capitalize the rest of characters. |
|
static
|
cast(Object x)
This utility method is used to suppress the need for @SuppressWarnings when we cast objects to List < ? |
|
static boolean |
isJavaIdentifier(String s)
Checks if a given string is usable as a Java identifier. |
|
protected static boolean |
isLower(char c)
Determine if character is lowercase. |
|
static boolean |
isPunct(char c)
Determine if character is punctuation. |
|
static String |
lowerFirstChar(String str)
Return the first character as a lower case character. |
|
static String |
toClassName(String s)
Returns a JAXB compatible class name. |
|
static String |
toMixedCaseName(List<String> ss,
boolean startUpper)
Concatenates the pieces into a mixed case name. |
|
static String |
toPackageName(String uri)
. |
|
static String |
toVariableName(String s)
Returns a JAXB compatible variable name. |
|
static List<String> |
toWordList(String s)
Tokenizes a string into words and capitalizes the first character of each word. |
|
static String |
upperFirstChar(String str)
Return the first character as a upper case character. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> T cast(Object x)
T
- the list typex
- the object to cast
public static boolean isPunct(char c)
c
- the character
protected static boolean isLower(char c)
c
- the character to test
public static String toVariableName(String s)
s
- the original string
public static String toClassName(String s)
s
- the original string
public static List<String> toWordList(String s)
s
- the original word
This method uses a change in character type as a splitter of two words. For example, "abc100ghi" will be splitted into {"Abc", "100","Ghi"}.
public static String capitalize(String s)
s
- the original word
public static String toMixedCaseName(List<String> ss, boolean startUpper)
ss
- the array of strings to concatenatestartUpper
- leaves casing unchanged of true, otherwise
lowercases the first sequence
public static String lowerFirstChar(String str)
str
- the string from which character must be extracted
public static String upperFirstChar(String str)
str
- the string from which character must be extracted
public static boolean isJavaIdentifier(String s)
s
- a character string
public static String toPackageName(String uri)
uri
- the target namespace
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |