Package com.globalmentor.java
Class Java
java.lang.Object
com.globalmentor.java.Java
Various utilities to assist programming with language-specific Java features.
- Author:
- Garret Wilson
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The system property name that represents whether internationalization is turned on.static final char
The character used to separate internal classes in Java class names.static final String
The name extension for Java files.static final String
The Java URI scheme identifier.static final String
The string representing the null keyword.static final char
The character used to separate an object and its predicate in an identifier string.static final char
The character used to separate packages in Java class names. -
Method Summary
Modifier and TypeMethodDescriptionstatic final <T extends Comparable<T>>
intcompareTo
(T comparable1, T comparable2) Compares one object with another, taking into account that one or both objects may benull
.static String
createVariableName
(String string) Creates a safe Java variable name by replacing all illegal characters with the underscore ('_') character.static String
getProperName
(String name) Constructs a proper name from the given name by capitalizing the first letter of the name.static String
getVariableName
(String name) Constructs a variable name from the given name by decapitalizing all of the beginning uppercase letters of the name.
-
Field Details
-
JAVA_FILENAME_EXTENSION
The name extension for Java files.- See Also:
-
NULL_KEYWORD
The string representing the null keyword.- See Also:
-
INTERNAL_CLASS_SEPARATOR
public static final char INTERNAL_CLASS_SEPARATORThe character used to separate internal classes in Java class names.- See Also:
-
PACKAGE_SEPARATOR
public static final char PACKAGE_SEPARATORThe character used to separate packages in Java class names.- See Also:
-
OBJECT_PREDICATE_SEPARATOR
public static final char OBJECT_PREDICATE_SEPARATORThe character used to separate an object and its predicate in an identifier string.- See Also:
-
I18N_PROPERTY_NAME
The system property name that represents whether internationalization is turned on.- See Also:
-
JAVA_URI_SCHEME
The Java URI scheme identifier.- See Also:
-
-
Method Details
-
compareTo
Compares one object with another, taking into account that one or both objects may benull
. If one object isnull
but the other is not, thenull
object is considered to be less than the non-null
object.- Type Parameters:
T
- The type of object being compared.- Parameters:
comparable1
- The first object to compare.comparable2
- The second object to compare.- Returns:
- A negative integer, zero, or a positive integer if the first object is less than, equal to, or greater than the specified annotation, respectively,
with a
null
considered less than a non-null
value. - See Also:
-
getProperName
Constructs a proper name from the given name by capitalizing the first letter of the name.- Parameters:
name
- The name to convert to a proper name.- Returns:
- A proper name appropriate for the given name.
- See Also:
-
getVariableName
Constructs a variable name from the given name by decapitalizing all of the beginning uppercase letters of the name.- Parameters:
name
- The name to convert to a variable name.- Returns:
- A variable name appropriate for the given name.
- See Also:
-
createVariableName
Creates a safe Java variable name by replacing all illegal characters with the underscore ('_') character. This version only checks for the '.' and '$' characters.- Parameters:
string
- A string to convert to a variable- Returns:
- The string converted to a safe Java variable name.
-