- java.lang.Object
-
- org.glassfish.jaxb.core.api.impl.NameConverter.Standard
-
- All Implemented Interfaces:
NameConverter
- Enclosing interface:
- NameConverter
public static class NameConverter.Standard extends Object implements NameConverter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.glassfish.jaxb.core.api.impl.NameConverter
NameConverter.Standard
-
-
Field Summary
Fields Modifier and Type Field Description protected static intDIGITprotected static intLOWER_LETTERprotected static intOTHERprotected static intOTHER_LETTERprotected static intUPPER_LETTER-
Fields inherited from interface org.glassfish.jaxb.core.api.impl.NameConverter
jaxrpcCompatible, smart, standard
-
-
Constructor Summary
Constructors Constructor Description Standard()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringcapitalize(String s)Capitalizes the first character of the specified string, and de-capitalize the rest of characters.protected intclassify(char c0)Classify a character into 5 categories that determine the word break.static voidescape(StringBuilder sb, String s, int start)Escapes characters is the given string so that they can be printed by only using US-ASCII characters.protected static booleanisDigit(char c)protected booleanisLetter(char c)protected static booleanisLower(char c)protected booleanisPunct(char c)protected static booleanisUpper(char c)StringtoClassName(String s)converts a string into an identifier suitable for classes.StringtoConstantName(String token)Formats a string into "THIS_KIND_OF_FORMAT_ABC_DEF".StringtoConstantName(List<String> ss)Formats a string into "THIS_KIND_OF_FORMAT_ABC_DEF".StringtoInterfaceName(String token)converts a string into an identifier suitable for interfaces.protected StringtoMixedCaseName(List<String> ss, boolean startUpper)protected StringtoMixedCaseVariableName(String[] ss, boolean startUpper, boolean cdrUpper)StringtoPackageName(String nsUri)Computes a Java package name from a namespace URI, as specified in the spec.StringtoPropertyName(String s)converts a string into an identifier suitable for properties.StringtoVariableName(String s)Converts a string into an identifier suitable for variables.List<String>toWordList(String s)Tokenizes a string into words and capitalizes the first character of each word.
-
-
-
Field Detail
-
UPPER_LETTER
protected static final int UPPER_LETTER
- See Also:
- Constant Field Values
-
LOWER_LETTER
protected static final int LOWER_LETTER
- See Also:
- Constant Field Values
-
OTHER_LETTER
protected static final int OTHER_LETTER
- See Also:
- Constant Field Values
-
DIGIT
protected static final int DIGIT
- See Also:
- Constant Field Values
-
OTHER
protected static final int OTHER
- See Also:
- Constant Field Values
-
-
Method Detail
-
toClassName
public String toClassName(String s)
Description copied from interface:NameConverterconverts a string into an identifier suitable for classes. In general, this operation should generate "NamesLikeThis".- Specified by:
toClassNamein interfaceNameConverter
-
toVariableName
public String toVariableName(String s)
Description copied from interface:NameConverterConverts a string into an identifier suitable for variables. In general it should generate "namesLikeThis".- Specified by:
toVariableNamein interfaceNameConverter
-
toInterfaceName
public String toInterfaceName(String token)
Description copied from interface:NameConverterconverts a string into an identifier suitable for interfaces. In general, this operation should generate "NamesLikeThis". But for example, it can prepend every interface with 'I'.- Specified by:
toInterfaceNamein interfaceNameConverter
-
toPropertyName
public String toPropertyName(String s)
Description copied from interface:NameConverterconverts a string into an identifier suitable for properties. In general, this operation should generate "NamesLikeThis", which will be used with known prefixes like "get" or "set".- Specified by:
toPropertyNamein interfaceNameConverter
-
toConstantName
public String toConstantName(String token)
Formats a string into "THIS_KIND_OF_FORMAT_ABC_DEF".- Specified by:
toConstantNamein interfaceNameConverter- Returns:
- Always return a string but there's no guarantee that the generated code is a valid Java identifier.
-
toPackageName
public String toPackageName(String nsUri)
Computes a Java package name from a namespace URI, as specified in the spec.- Specified by:
toPackageNamein interfaceNameConverter- Returns:
- null if it fails to derive a package name.
-
isPunct
protected boolean isPunct(char c)
-
isDigit
protected static boolean isDigit(char c)
-
isUpper
protected static boolean isUpper(char c)
-
isLower
protected static boolean isLower(char c)
-
isLetter
protected boolean isLetter(char c)
-
capitalize
public String capitalize(String s)
Capitalizes the first character of the specified string, and de-capitalize the rest of characters.
-
classify
protected int classify(char c0)
Classify a character into 5 categories that determine the word break.
-
toWordList
public List<String> toWordList(String s)
Tokenizes a string into words and capitalizes the first character of each 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"}.
-
toMixedCaseVariableName
protected String toMixedCaseVariableName(String[] ss, boolean startUpper, boolean cdrUpper)
-
toConstantName
public String toConstantName(List<String> ss)
Formats a string into "THIS_KIND_OF_FORMAT_ABC_DEF".- Returns:
- Always return a string but there's no guarantee that the generated code is a valid Java identifier.
-
escape
public static void escape(StringBuilder sb, String s, int start)
Escapes characters is the given string so that they can be printed by only using US-ASCII characters. The escaped characters will be appended to the given StringBuffer.- Parameters:
sb- StringBuffer that receives escaped string.s- String to be escaped.s.substring(start)will be escaped and copied to the string buffer.
-
-