|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface JavaNaming
JavaNaming is a service which collects all methods that are related to create (modify) Java names. E.g. convert from XML name to Java name, get a Java member name or such. These rules can be exchanged by a different implementation to get a different naming style for e.g. JAXB.
| Field Summary | |
|---|---|
static char |
FIELD_UNDERSCORE_PREFIX
The underscore field prefix. |
static String |
METHOD_PREFIX_ADD
Add methods start with: add. |
static String |
METHOD_PREFIX_CREATE
Create methods start with: create. |
static String |
METHOD_PREFIX_GET
Get methods start with: get. |
static String |
METHOD_PREFIX_IS
Is methods start with: is. |
static String |
METHOD_PREFIX_SET
Set methods start with: set. |
| Method Summary | |
|---|---|
String |
extractFieldNameFromField(Field field)
Extracts the field name part from the Field. |
String |
extractFieldNameFromMethod(Method method)
Extracts the filed name part from the methods name. |
String |
getAddMethodNameForField(String fieldName)
Generates the name of an add method for the given field name. |
String |
getClassName(Class clazz)
Gets the class name without package part. |
String |
getCreateMethodNameForField(String fieldName)
Generates the name of a create method for the given field name. |
String |
getGetMethodNameForField(String fieldName)
Generates the name of a get method for the given field name. |
String |
getIsMethodNameForField(String fieldName)
Generates the name of an is method for the given field name. |
String |
getPackageName(String className)
Gets the package name of the given class name. |
String |
getQualifiedFileName(String fileName,
String packageName)
Qualifies the given fileName with the given
packageName and returns the resulting file path. |
String |
getSetMethodNameForField(String fieldName)
Generates the name of a set method for the given field name. |
boolean |
isAddMethod(Method method)
Checks if the given method is an add method. |
boolean |
isCreateMethod(Method method)
Checks if the given method is a create method. |
boolean |
isGetMethod(Method method)
Checks if the given method is a get method. |
boolean |
isIsMethod(Method method)
Checks if the given method is an is method. |
boolean |
isKeyword(String name)
Returns true if the given String is a Java keyword which will cause a problem when used as a variable name. |
boolean |
isSetMethod(Method method)
Checks if the given method is a set method. |
boolean |
isValidJavaIdentifier(String string)
Returns true if the given String matches the production of a valid Java identifier. |
boolean |
isValidPackageName(String packageName)
Checks if the given package name is valid or not. |
String |
packageToPath(String packageName)
Converts the given Package name to it's corresponding Path. |
String |
toJavaClassName(String name)
Cuts away a leading namespace prefix (if there is one in place). |
String |
toJavaMemberName(String name)
Appends a leading '_' and converts the given name to a java name. |
String |
toJavaMemberName(String name,
boolean useKeywordSubstitutions)
Appends a leading '_' and converts the given name to a java name. |
| Field Detail |
|---|
static final String METHOD_PREFIX_ADD
static final String METHOD_PREFIX_GET
static final String METHOD_PREFIX_IS
static final String METHOD_PREFIX_SET
static final String METHOD_PREFIX_CREATE
static final char FIELD_UNDERSCORE_PREFIX
| Method Detail |
|---|
boolean isKeyword(String name)
name - The name to check.
boolean isValidJavaIdentifier(String string)
string - The String to check the production of.
String toJavaClassName(String name)
name - The XML name to convert to a Java name.
String toJavaMemberName(String name)
name - the XML name to convert.
String toJavaMemberName(String name,
boolean useKeywordSubstitutions)
name - The XML name to convert.useKeywordSubstitutions - Set to true to turn on keyword substitution.
boolean isValidPackageName(String packageName)
packageName - Name of package as String with periods.
String packageToPath(String packageName)
packageName - The package name to convert.
String getQualifiedFileName(String fileName,
String packageName)
fileName with the given
packageName and returns the resulting file path.packageName is null or a zero-length
String, this method will return fileName.
fileName - The file name to be qualified.packageName - The package name to be used for qualifying.
String getClassName(Class clazz)
clazz - The class to retrieve the name from
String getPackageName(String className)
className - The class name to retrieve the package name from.
className
is null or does not contain a package.String extractFieldNameFromMethod(Method method)
method - The Method to process.
String extractFieldNameFromField(Field field)
field - the Field to process
boolean isSetMethod(Method method)
method - The Method to check
boolean isCreateMethod(Method method)
method - The Method to check.
boolean isGetMethod(Method method)
method - The Method to check.
boolean isIsMethod(Method method)
method - The Method to check.
boolean isAddMethod(Method method)
method - The Method to check.
String getAddMethodNameForField(String fieldName)
fieldName - The field name to generate a method name for.
String getSetMethodNameForField(String fieldName)
fieldName - The field name to generate a method name for.
String getGetMethodNameForField(String fieldName)
fieldName - The field name to generate a method name for.
String getIsMethodNameForField(String fieldName)
fieldName - The field name to generate a method name for.
String getCreateMethodNameForField(String fieldName)
fieldName - The field name to generate a method name for.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||