Package org.exolab.javasource
Class JNaming
- java.lang.Object
-
- org.exolab.javasource.JNaming
-
public final class JNaming extends java.lang.ObjectA utility class used to validate identifiers and class names.- Version:
- $Revision: 6669 $ $Date: 2003-03-03 00:05:44 -0700 (Mon, 03 Mar 2003) $
- Author:
- Keith Visco
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetLocalNameFromClassName(java.lang.String className)Returns the local class name from the given fully qualified class name.static java.lang.StringgetPackageFromClassName(java.lang.String className)Returns the package name from the given class name.static booleanisInJavaLang(java.lang.String name)Returns true if the given String is a Java class in java.lang.* which will cause a problem when used as a variable name.static booleanisKeyword(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.static booleanisParameterizedCollectionsObject(java.lang.String name)Returns true if the given String is a parameterized Java collection.static booleanisReservedByCastor(java.lang.String name)Returns true if the given String is a reserved name by Castor which may cause a problem when used as a variable name.static booleanisReservedByWindows(java.lang.String name)Returns true if the given String is a reserved name by the Windows filesystem which will cause a problem when used as a class name under Windows.static booleanisValidJavaIdentifier(java.lang.String string)Returns true if the given String matches the production of a valid Java identifier.
-
-
-
Method Detail
-
isKeyword
public static 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.- Parameters:
name- The String to check against the list of keywords.- Returns:
- True if the given String is a Java keyword which will cause a problem when used as a variable name.
-
isParameterizedCollectionsObject
public static boolean isParameterizedCollectionsObject(java.lang.String name)
Returns true if the given String is a parameterized Java collection. object keyword which will cause a problem when used as a variable name- Parameters:
name- The String to check as a parameterized Java collection.- Returns:
- True if the given String is a parameterized Java collection object keyword which will cause a problem when used as a variable name.
-
isInJavaLang
public static boolean isInJavaLang(java.lang.String name)
Returns true if the given String is a Java class in java.lang.* which will cause a problem when used as a variable name.- Parameters:
name- The String to check against the list of keywords.- Returns:
- True if the given String is a Java class in java.lang.* which will cause a problem when used as a variable name.
-
isReservedByCastor
public static boolean isReservedByCastor(java.lang.String name)
Returns true if the given String is a reserved name by Castor which may cause a problem when used as a variable name. Some fields that Castor uses depend on the contents of the schema, so we only warn.- Parameters:
name- The String to check against the list of keywords.- Returns:
- True if the given String is a reserved name by Castor which may cause a problem when used as a variable name.
-
isReservedByWindows
public static boolean isReservedByWindows(java.lang.String name)
Returns true if the given String is a reserved name by the Windows filesystem which will cause a problem when used as a class name under Windows.- Parameters:
name- The String to check against the list of keywords.- Returns:
- True if the given String is a reserved name by Castor which may cause a problem when used as a variable name.
-
isValidJavaIdentifier
public static boolean isValidJavaIdentifier(java.lang.String string)
Returns true if the given String matches the production of a valid Java identifier.- Parameters:
string- The String to check the production of.- Returns:
- True if the given String matches the production of a valid Java name, otherwise false.
-
getPackageFromClassName
public static java.lang.String getPackageFromClassName(java.lang.String className)
Returns the package name from the given class name.- Parameters:
className- An arbitrary class name, optionally including a package.- Returns:
- The package name from the given class name.
-
getLocalNameFromClassName
public static java.lang.String getLocalNameFromClassName(java.lang.String className)
Returns the local class name from the given fully qualified class name.- Parameters:
className- An arbitrary class name, optionally including a package.- Returns:
- The local name from the given class name.
-
-