Class Java


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

      Fields 
      Modifier and Type Field Description
      static java.lang.String I18N_PROPERTY_NAME
      The system property name that represents whether internationalization is turned on.
      static char INTERNAL_CLASS_SEPARATOR
      The character used to separate internal classes in Java class names.
      static java.lang.String JAVA_NAME_EXTENSION
      The name extension for Java files.
      static java.lang.String JAVA_URI_SCHEME
      The Java URI scheme identifier.
      static java.lang.String NULL_KEYWORD
      The string representing the null keyword.
      static char OBJECT_PREDICATE_SEPARATOR
      The character used to separate an object and its predicate in an identifier string.
      static char PACKAGE_SEPARATOR
      The character used to separate packages in Java class names.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends java.lang.Comparable<T>>
      int
      compareTo​(T comparable1, T comparable2)
      Compares one object with another, taking into account that one or both objects may be null.
      static java.lang.String createVariableName​(java.lang.String string)
      Creates a safe Java variable name by replacing all illegal characters with the underscore ('_') character.
      static java.lang.String getProperName​(java.lang.String name)
      Constructs a proper name from the given name by capitalizing the first letter of the name.
      static java.lang.String getVariableName​(java.lang.String name)
      Constructs a variable name from the given name by decapitalizing all of the beginning uppercase letters of the name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • JAVA_NAME_EXTENSION

        public static final java.lang.String JAVA_NAME_EXTENSION
        The name extension for Java files.
        See Also:
        Constant Field Values
      • NULL_KEYWORD

        public static final java.lang.String NULL_KEYWORD
        The string representing the null keyword.
        See Also:
        Constant Field Values
      • INTERNAL_CLASS_SEPARATOR

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

        public static final char PACKAGE_SEPARATOR
        The character used to separate packages in Java class names.
        See Also:
        Constant Field Values
      • 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:
        Constant Field Values
      • I18N_PROPERTY_NAME

        public static final java.lang.String I18N_PROPERTY_NAME
        The system property name that represents whether internationalization is turned on.
        See Also:
        DefaultStyledDocument, Constant Field Values
      • JAVA_URI_SCHEME

        public static final java.lang.String JAVA_URI_SCHEME
        The Java URI scheme identifier.
        See Also:
        Constant Field Values
    • Method Detail

      • compareTo

        public static final <T extends java.lang.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:
        Comparable.compareTo(Object)
      • getProperName

        public static java.lang.String getProperName​(java.lang.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(String)
      • getVariableName

        public static java.lang.String getVariableName​(java.lang.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:
        getProperName(String)
      • createVariableName

        public static java.lang.String createVariableName​(java.lang.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.