| java.lang.Object org.glasser.util.Util
Util | public class Util (Code) | | This class provides miscellaneous trivial utility methods.
|
Method Summary | |
public static void | addMappings(Map map, Object[][] mappings) | public static String | breakLine(String line, int segLength) Breaks the given line into segments, separated by newline ('\n')
characters. | public static HashMap | buildMap(Object[][] mappings) | public static Class | getWrapperClass(Class primitiveClass) Given the Class for a primitive type, such as int.class or byte.class,
this method will return the corresponding wrapper class, such
as Integer.class or Byte.class. | public static boolean | isCurrentJavaVersionAtLeast(String minVersion) This determines if the currently executing Java version (read from the
System property "java.version" is equal to or later than the version
string passed in.
Parameters: minVersion - a String representing a Java version, for example "1.3.1". | public static boolean | isNothing(Object object) Returns true if the given object is null, or if it's toString() method
returns all whitespace. | public static String | trim(String s) Trims a String without the need to null-check first. | public static String | trimToNull(String s) If s is null or all whitespace, null is returned, otherwise
s.trim() is returned. | public static String | trimToString(String s) If s is null or all whitespace, a zero-length String ("") is returned,
otherwise s.trim() is returned. | public static String | wrapLines(String lines, int lineLength) Given a string which may already contain linebreak characters, this method
will separate it into its individual lines, and then pass each line to
breakLine with the lineLength argument. |
addMappings | public static void addMappings(Map map, Object[][] mappings)(Code) | | |
breakLine | public static String breakLine(String line, int segLength)(Code) | | Breaks the given line into segments, separated by newline ('\n')
characters. Each segment is at least "segLength" characters long.
The break occurs at the first space character after seglength.
|
getWrapperClass | public static Class getWrapperClass(Class primitiveClass)(Code) | | Given the Class for a primitive type, such as int.class or byte.class,
this method will return the corresponding wrapper class, such
as Integer.class or Byte.class.
|
isCurrentJavaVersionAtLeast | public static boolean isCurrentJavaVersionAtLeast(String minVersion)(Code) | | This determines if the currently executing Java version (read from the
System property "java.version" is equal to or later than the version
string passed in.
Parameters: minVersion - a String representing a Java version, for example "1.3.1". The String may only contain digits and dots. |
isNothing | public static boolean isNothing(Object object)(Code) | | Returns true if the given object is null, or if it's toString() method
returns all whitespace.
|
trim | public static String trim(String s)(Code) | | Trims a String without the need to null-check first. If s is null,
null is returned, otherwise s.trim() is returned.
|
trimToNull | public static String trimToNull(String s)(Code) | | If s is null or all whitespace, null is returned, otherwise
s.trim() is returned.
|
trimToString | public static String trimToString(String s)(Code) | | If s is null or all whitespace, a zero-length String ("") is returned,
otherwise s.trim() is returned.
|
wrapLines | public static String wrapLines(String lines, int lineLength)(Code) | | Given a string which may already contain linebreak characters, this method
will separate it into its individual lines, and then pass each line to
breakLine with the lineLength argument.
|
|
|