|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
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 java.lang.String |
METHOD_PREFIX_ADD
Add methods start with: add. |
static java.lang.String |
METHOD_PREFIX_CREATE
Create methods start with: create. |
static java.lang.String |
METHOD_PREFIX_GET
Get methods start with: get. |
static java.lang.String |
METHOD_PREFIX_IS
Is methods start with: is. |
static java.lang.String |
METHOD_PREFIX_SET
Set methods start with: set. |
| Method Summary | |
java.lang.String |
extractFieldNameFromField(java.lang.reflect.Field field)
Extracts the field name part from the Field. |
java.lang.String |
extractFieldNameFromMethod(java.lang.reflect.Method method)
Extracts the filed name part from the methods name. |
java.lang.String |
getAddMethodNameForField(java.lang.String fieldName)
Generates the name of an add method for the given field name. |
java.lang.String |
getClassName(java.lang.Class clazz)
Gets the class name without package part. |
java.lang.String |
getCreateMethodNameForField(java.lang.String fieldName)
Generates the name of a create method for the given field name. |
java.lang.String |
getGetMethodNameForField(java.lang.String fieldName)
Generates the name of a get method for the given field name. |
java.lang.String |
getIsMethodNameForField(java.lang.String fieldName)
Generates the name of an is method for the given field name. |
java.lang.String |
getPackageName(java.lang.String className)
Gets the package name of the given class name. |
java.lang.String |
getQualifiedFileName(java.lang.String fileName,
java.lang.String packageName)
Qualifies the given fileName with the given
packageName and returns the resulting file path. |
java.lang.String |
getSetMethodNameForField(java.lang.String fieldName)
Generates the name of a set method for the given field name. |
boolean |
isAddMethod(java.lang.reflect.Method method)
Checks if the given method is an add method. |
boolean |
isCreateMethod(java.lang.reflect.Method method)
Checks if the given method is a create method. |
boolean |
isGetMethod(java.lang.reflect.Method method)
Checks if the given method is a get method. |
boolean |
isIsMethod(java.lang.reflect.Method method)
Checks if the given method is an is method. |
boolean |
isKeyword(java.lang.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(java.lang.reflect.Method method)
Checks if the given method is a set method. |
boolean |
isValidJavaIdentifier(java.lang.String string)
Returns true if the given String matches the production of a valid Java identifier. |
boolean |
isValidPackageName(java.lang.String packageName)
Checks if the given package name is valid or not. |
java.lang.String |
packageToPath(java.lang.String packageName)
Converts the given Package name to it's corresponding Path. |
java.lang.String |
toJavaClassName(java.lang.String name)
Cuts away a leading namespace prefix (if there is one in place). |
java.lang.String |
toJavaMemberName(java.lang.String name)
Appends a leading '_' and converts the given name to a java name. |
java.lang.String |
toJavaMemberName(java.lang.String name,
boolean useKeywordSubstitutions)
Appends a leading '_' and converts the given name to a java name. |
| Field Detail |
public static final java.lang.String METHOD_PREFIX_ADD
public static final java.lang.String METHOD_PREFIX_GET
public static final java.lang.String METHOD_PREFIX_IS
public static final java.lang.String METHOD_PREFIX_SET
public static final java.lang.String METHOD_PREFIX_CREATE
public static final char FIELD_UNDERSCORE_PREFIX
| Method Detail |
public boolean isKeyword(java.lang.String name)
name - The name to check.
public boolean isValidJavaIdentifier(java.lang.String string)
string - The String to check the production of.
public java.lang.String toJavaClassName(java.lang.String name)
name - The XML name to convert to a Java name.
public java.lang.String toJavaMemberName(java.lang.String name)
name - the XML name to convert.
public java.lang.String toJavaMemberName(java.lang.String name,
boolean useKeywordSubstitutions)
name - The XML name to convert.useKeywordSubstitutions - Set to true to turn on keyword substitution.
public boolean isValidPackageName(java.lang.String packageName)
packageName - Name of package as String with periods.
public java.lang.String packageToPath(java.lang.String packageName)
packageName - The package name to convert.
public java.lang.String getQualifiedFileName(java.lang.String fileName,
java.lang.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.
public java.lang.String getClassName(java.lang.Class clazz)
clazz - The class to retrieve the name from
public java.lang.String getPackageName(java.lang.String className)
className - The class name to retrieve the package name from.
className
is null or does not contain a package.public java.lang.String extractFieldNameFromMethod(java.lang.reflect.Method method)
method - The Method to process.
public java.lang.String extractFieldNameFromField(java.lang.reflect.Field field)
field - the Field to process
public boolean isSetMethod(java.lang.reflect.Method method)
method - The Method to check
public boolean isCreateMethod(java.lang.reflect.Method method)
method - The Method to check.
public boolean isGetMethod(java.lang.reflect.Method method)
method - The Method to check.
public boolean isIsMethod(java.lang.reflect.Method method)
method - The Method to check.
public boolean isAddMethod(java.lang.reflect.Method method)
method - The Method to check.
public java.lang.String getAddMethodNameForField(java.lang.String fieldName)
fieldName - The field name to generate a method name for.
public java.lang.String getSetMethodNameForField(java.lang.String fieldName)
fieldName - The field name to generate a method name for.
public java.lang.String getGetMethodNameForField(java.lang.String fieldName)
fieldName - The field name to generate a method name for.
public java.lang.String getIsMethodNameForField(java.lang.String fieldName)
fieldName - The field name to generate a method name for.
public java.lang.String getCreateMethodNameForField(java.lang.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 | ||||||||||