|
2004.04.29 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--jdc.java.lang.Object
|
+--com.jdc.lang.ObjectHelper
ObjectHelper is a utility class that provides basic String
manipulation methods to the Object class. For example,
rather than coding the following to test for a non-null, non-blank String
value:
if (!(string == null) && !(string.trim().equals("")))
{
// do something
}
This object helper utility class simplifies the coding as follows:
if (helper.isValue(string))
{
// do something
}
where helper is an instance of this class.
For additional String manipulation methods not provided by
this utility class, refer to the StringHelper class.
Object,
StringHelper,
Serialized Form| Constructor Summary | |
ObjectHelper()
Constructs a new ObjectHelper instance. |
|
| Method Summary | |
boolean |
equals(String stringOne,
String stringTwo)
Returns true if the two input String field values
are equal. |
boolean |
isNoValue(String string)
Returns true if the String field contains a null
or blank value. |
boolean |
isValue(String string)
Returns true if the String field contains a non-null,
non-blank value. |
String |
noValue()
Returns an empty String value. |
String |
toValue(String string)
Returns a non-null String value given a String
field value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ObjectHelper()
ObjectHelper instance.
| Method Detail |
public boolean equals(String stringOne,
String stringTwo)
true if the two input String field values
are equal. This convenience method is provided to simplify the comparison
of two String field values, one or both of which may be null.
The two String field values are considered equal if one of the
following is true:
String fields contain the same String value.String fields contain a null value.String comparison. The comparison is case-sensitive.
For example:
true is returned.false is returned.
True if the String fields are considered equal. False if the String fields are not considered equal. public String noValue()
String value. An empty String is
defined as "", i.e. a non-null String with no length.
This convenience method is provided to return the defined static
String constant NO_VALUE in the Object
class and its subclasses which include an instance of this class.
String value.public boolean isNoValue(String string)
true if the String field contains a null
or blank value. A String field that contains any number of blanks
(or spaces) is considered a blank value.
True if the String field contains a null or blank value. False if the String field contains a non-null, non-blank value. isValue(java.lang.String)public boolean isValue(String string)
true if the String field contains a non-null,
non-blank value. A String field that contains any number of blanks
(or spaces) is considered a blank value.
True if the String field contains a non-null, non-blank value. False if the String field contains a null or blank value. isNoValue(java.lang.String)public String toValue(String string)
String value given a String
field value. If the String field value is null, an
empty String value is returned, i.e. a null value is
never returned. Otherwise, the original String field
value is returned with leading and trailing blanks (spaces) removed.
String value.
|
2004.04.29 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||