JavaNaming
public class JavaNamingImpl extends java.lang.Object implements JavaNaming
Modifier and Type | Field | Description |
---|---|---|
static boolean |
_upperCaseAfterUnderscore |
Used for backward compatibility, if you wish to be backward compatible
with 0.9.3.9 and earlier set this boolean to true.
|
static java.lang.String |
UPPER_CASE_AFTER_UNDERSCORE_PROPERTY |
The property name to use in the castor.properties file to specify the
value of the
upperCaseAfterUnderscore variable. |
FIELD_UNDERSCORE_PREFIX, METHOD_PREFIX_ADD, METHOD_PREFIX_CREATE, METHOD_PREFIX_GET, METHOD_PREFIX_IS, METHOD_PREFIX_SET
Constructor | Description |
---|---|
JavaNamingImpl() |
private constructor.
|
Modifier and Type | Method | Description |
---|---|---|
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 set 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.If packageName is null or a zero-length
String, this method will return fileName . |
java.lang.String |
getSetMethodNameForField(java.lang.String fieldName) |
Generates the name of a create 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 a '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 pacckage 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.
|
public static final java.lang.String UPPER_CASE_AFTER_UNDERSCORE_PROPERTY
upperCaseAfterUnderscore
variable.public static boolean _upperCaseAfterUnderscore
public final boolean isKeyword(java.lang.String name)
isKeyword
in interface JavaNaming
name
- the name to checkJavaNaming.isKeyword(java.lang.String)
public final boolean isValidJavaIdentifier(java.lang.String string)
isValidJavaIdentifier
in interface JavaNaming
string
- The String to check the production of.JavaNaming.isValidJavaIdentifier(java.lang.String)
public final java.lang.String toJavaClassName(java.lang.String name)
toJavaClassName
in interface JavaNaming
name
- the XML name to convert to a Java nameJavaNaming.toJavaClassName(java.lang.String)
public final java.lang.String toJavaMemberName(java.lang.String name)
toJavaMemberName
in interface JavaNaming
name
- the XML name to convertJavaNaming.toJavaMemberName(java.lang.String)
public final java.lang.String toJavaMemberName(java.lang.String name, boolean useKeywordSubstitutions)
toJavaMemberName
in interface JavaNaming
name
- the XML name to convertuseKeywordSubstitutions
- set to true to turn on keyword substitutionJavaNaming.toJavaMemberName(java.lang.String,boolean)
public final boolean isValidPackageName(java.lang.String packageName)
isValidPackageName
in interface JavaNaming
packageName
- name of package as String with periodsJavaNaming.isValidPackageName(java.lang.String)
public final java.lang.String packageToPath(java.lang.String packageName)
packageToPath
in interface JavaNaming
packageName
- the package name to convertJavaNaming.packageToPath(java.lang.String)
public final 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
.getQualifiedFileName
in interface JavaNaming
fileName
- The file name to be qualified.packageName
- The package name to be used for qualifying.JavaNaming.getQualifiedFileName(java.lang.String,java.lang.String)
public final java.lang.String getPackageName(java.lang.String className)
getPackageName
in interface JavaNaming
className
- The class name to retrieve the package name from.className
is null
or does not contain a package.JavaNaming.getPackageName(java.lang.String)
public final java.lang.String extractFieldNameFromMethod(java.lang.reflect.Method method)
extractFieldNameFromMethod
in interface JavaNaming
method
- the Method to processJavaNaming.extractFieldNameFromMethod(java.lang.reflect.Method)
public final java.lang.String extractFieldNameFromField(java.lang.reflect.Field field)
extractFieldNameFromField
in interface JavaNaming
field
- the Field to processJavaNaming.extractFieldNameFromField(java.lang.reflect.Field)
public final boolean isSetMethod(java.lang.reflect.Method method)
isSetMethod
in interface JavaNaming
method
- the Method to checkJavaNaming.isSetMethod(java.lang.reflect.Method)
public final boolean isCreateMethod(java.lang.reflect.Method method)
isCreateMethod
in interface JavaNaming
method
- the Method to checkJavaNaming.isCreateMethod(java.lang.reflect.Method)
public final boolean isGetMethod(java.lang.reflect.Method method)
isGetMethod
in interface JavaNaming
method
- the Method to checkJavaNaming.isGetMethod(java.lang.reflect.Method)
public final boolean isIsMethod(java.lang.reflect.Method method)
isIsMethod
in interface JavaNaming
method
- the Method to checkJavaNaming.isIsMethod(java.lang.reflect.Method)
public final boolean isAddMethod(java.lang.reflect.Method method)
isAddMethod
in interface JavaNaming
method
- the Method to checkJavaNaming.isAddMethod(java.lang.reflect.Method)
public final java.lang.String getAddMethodNameForField(java.lang.String fieldName)
getAddMethodNameForField
in interface JavaNaming
fieldName
- the field name to generate a method name forpublic final java.lang.String getCreateMethodNameForField(java.lang.String fieldName)
getCreateMethodNameForField
in interface JavaNaming
fieldName
- the field name to generate a method name forpublic final java.lang.String getGetMethodNameForField(java.lang.String fieldName)
getGetMethodNameForField
in interface JavaNaming
fieldName
- the field name to generate a method name forpublic final java.lang.String getIsMethodNameForField(java.lang.String fieldName)
getIsMethodNameForField
in interface JavaNaming
fieldName
- the field name to generate a method name forpublic final java.lang.String getSetMethodNameForField(java.lang.String fieldName)
getSetMethodNameForField
in interface JavaNaming
fieldName
- the field name to generate a method name forpublic java.lang.String getClassName(java.lang.Class clazz)
getClassName
in interface JavaNaming
clazz
- The class to retrieve the name fromJavaNaming.getClassName(java.lang.Class)
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com