com.jgoodies.forms.util
Class FormUtils
java.lang.Object
com.jgoodies.forms.util.FormUtils
public final class FormUtils
extends java.lang.Object
Consists only of static utility methods.
This class may be merged with the FormLayoutUtils extra - or not.
static void | assertNotBlank(String text, String description) - Throws an exception if the specified text is blank using the given
text description.
|
static void | assertNotNull(Object object, String description) - Throws an NPE if the given object is
null that uses
the specified text to describe the object.
|
static boolean | equals(Object o1, Object o2) - Checks and answers if the two objects are
both
null or equal.
|
static boolean | isBlank(String str) - Checks and answers if the given string is whitespace, empty (""),
or
null .
|
static boolean | isLafAqua() - Lazily checks and answers whether the Aqua look&feel is active.
|
static boolean | isNotBlank(String str) - Checks and answers if the given string is not empty (""),
not
null and not whitespace only.
|
assertNotBlank
public static void assertNotBlank(String text,
String description)
Throws an exception if the specified text is blank using the given
text description.
text
- the text to checkdescription
- describes the text, used in the exception message
assertNotNull
public static void assertNotNull(Object object,
String description)
Throws an NPE if the given object is null
that uses
the specified text to describe the object.
object
- the text to checkdescription
- describes the object, used in the exception message
equals
public static boolean equals(Object o1,
Object o2)
Checks and answers if the two objects are
both
null
or equal.
#equals(null, null) == true
#equals("Hi", "Hi") == true
#equals("Hi", null) == false
#equals(null, "Hi") == false
#equals("Hi", "Ho") == false
o1
- the first object to compareo2
- the second object to compare
- boolean
true
if and only if
both objects are null
or equal
isBlank
public static boolean isBlank(String str)
Checks and answers if the given string is whitespace, empty (""),
or
null
.
FormUtils.isBlank(null) == true
FormUtils.isBlank("") == true
FormUtils.isBlank(" ") == true
FormUtils.isBlank(" abc") == false
FormUtils.isBlank("abc ") == false
FormUtils.isBlank(" abc ") == false
str
- the string to check, may benull
true
if the string is whitespace, empty, or null
isLafAqua
public static boolean isLafAqua()
Lazily checks and answers whether the Aqua look&feel is active.
true
if the current look&feel is Aqua
isNotBlank
public static boolean isNotBlank(String str)
Checks and answers if the given string is not empty (""),
not
null
and not whitespace only.
FormUtils.isNotBlank(null) == false
FormUtils.isNotBlank("") == false
FormUtils.isNotBlank(" ") == false
FormUtils.isNotBlank(" abc") == true
FormUtils.isNotBlank("abc ") == true
FormUtils.isNotBlank(" abc ") == true
str
- the string to check, may be null
true
if the string is not empty
and not null
and not whitespace only
Copyright © 2002-2008 JGoodies Karsten Lentzsch. All Rights Reserved.