Class Java

java.lang.Object
com.globalmentor.java.Java

public class Java extends Object
Various utilities to assist programming with language-specific Java features.
Author:
Garret Wilson
  • Field Details

    • JAVA_FILENAME_EXTENSION

      public static final String JAVA_FILENAME_EXTENSION
      The name extension for Java files.
      See Also:
    • NULL_KEYWORD

      public static final String NULL_KEYWORD
      The string representing the null keyword.
      See Also:
    • INTERNAL_CLASS_SEPARATOR

      public static final char INTERNAL_CLASS_SEPARATOR
      The character used to separate internal classes in Java class names.
      See Also:
    • PACKAGE_SEPARATOR

      public static final char PACKAGE_SEPARATOR
      The character used to separate packages in Java class names.
      See Also:
    • OBJECT_PREDICATE_SEPARATOR

      public static final char OBJECT_PREDICATE_SEPARATOR
      The character used to separate an object and its predicate in an identifier string.
      See Also:
    • I18N_PROPERTY_NAME

      public static final String I18N_PROPERTY_NAME
      The system property name that represents whether internationalization is turned on.
      See Also:
    • JAVA_URI_SCHEME

      public static final String JAVA_URI_SCHEME
      The Java URI scheme identifier.
      See Also:
  • Method Details

    • compareTo

      public static final <T extends Comparable<T>> int compareTo(T comparable1, T comparable2)
      Compares one object with another, taking into account that one or both objects may be null. If one object is null but the other is not, the null 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

      public static String getProperName(String name)
      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

      public static String getVariableName(String name)
      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

      public static String createVariableName(String string)
      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.