|
"There are two ways of constructing a software design; one way is to make it so simple that there are obviously no deficiencies,
and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult."
-- C. A. R. Hoare
It kinda irks me that Sun basically deprecated java.util.Date in favor of
java.util.Calendar/GregorianCalendar yet didn't have Calendar implement the Comparable interface. It also irks me that
they constantly go 80-90% of the way, then stop short... for instance,
Arrays.sort() can take a single Comparator object, but not multiple comparators. irky.
That being said... I give you my utilities. They're not online yet,
since I wrote them at work, but you should have a good idea of what they do and
how insanely useful they are. If you're coming from a NeXT environment,
its basically EOQualifier and EOSortOrdering.
- EqualToPredicate [source]
- LessThanPredicate [source]
- GreaterThanPredicate [source]
- NullPredicate [source
- Comparison of two values.
- AndPredicate [source]
- Merge multiple predicates into one. For this predicate to succeed,
ALL of its predicates must succeed.
- OrPredicate [source]
- Merge multiple predicates into one. For this predicate to succeed,
ONE of its predicates must succeed.
- NotPredicate [source]
- Negates a predicate ( eg an AndPredicate ).
- BetweenPredicate [source]
- Convenience class for a LessThanOrEqualTo and a GreaterThanOrEqualTo, allowing one to
set a low and a high limit. Objects' properties must fall within
the low and high values in order for this predicate to succeed.
- InPredicate [source]
- Convenience class for multiple EqualTo comparison predicates.
For this predicate to succeed, the object's property must be equal
to any one of the objects passed in.
- ContainsPredicate [source]
- Check to see if a String contains a value, if a Collection contains a value, or if a Map contains a key. Supports wildcard expansion.
- PropertyComparator [source]
- Compares a value against an object's property, two objects' properties against one another, or two values
(static) against one another. Fixes Sun's stupid mistake with
Calendar (LessThan = before, GreaterThan = after).
- MultipleComparator [DEPRECATED: Use Jakarta Commons' ComparatorChain class instead]
- Given a list of comparators, combine them all into one. This would allow
one to, say, sort an array of Customer objects in alphabetical order
based on their first _and_ last names. Cool, eh ?
- StringUtils [source]
- Returns a List of StringTokenizer()'s output, checks to see if a String
contains any other strings (in a list), checks to see if a String
contains ALL strings in a list, stringWithContentsOfFile, and does
a rudimentary check to make sure an email address is in the proper format.
- ListUtils
- makes a List from an object array, fetches random objects from a list.
- EmailUtils
- Allows one to instantiate an Email object, set its to/from/etc
properties, send an email, reset its to/from/etc properties, and
use the same object to send a completely different email. Convenience.
- GregorianDate
- Fixes the stupidity Sun had when they deprecated Date in favor of the somewhat-less-advanced (Gregorian)Calendar. Provides convenience
methods to get at a calendar's data without resorting to numerous .get(Calendar.SOME_FIELD); ugliness. Also formats itself,
supports the Comparable interface (ala java.util.Date), and is generally much, much nicer than dealing with GregorianCalendars.
That's all for now. Oh, and I hate JavaDoc.
|