|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.odell.glazedlists.matchers.Matchers
public final class Matchers
A factory for creating Matchers.
| Method Summary | ||
|---|---|---|
static
|
beanPropertyMatcher(Class<E> beanClass,
String propertyName,
Object expectedValue)
Creates a Matcher that uses Reflection to compare the expectedValue
of the specified property of an object to the expectedValue. |
|
static
|
falseMatcher()
Get a Matcher that always returns false, therefore matching nothing.. |
|
static
|
filter(Collection<E> collection,
Matcher<? super E> matcher)
Iterate through the specified collection and remove all elements that don't match the specified matcher. |
|
static
|
invert(Matcher<E> original)
Get a Matcher that returns the opposite of the specified Matcher. |
|
static
|
rangeMatcher(D start,
D end)
Creates a Matcher that matches Comparable objects for
containment within the range between the given start
and end. |
|
static
|
rangeMatcher(D start,
D end,
Filterator<D,E> filterator)
Creates a Matcher that uses the given filterator
to extract Comparable objects from filtered objects and compares
those Comparables against the range between the given start
and end. |
|
static
|
trueMatcher()
Get a Matcher that always returns true, therefore matching everything. |
|
static
|
weakReferenceProxy(MatcherEditor<E> matcherEditor)
Provides a proxy to another MatcherEditor that may go out of scope without explicitly removing itself from the source MatcherEditor's set of listeners. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <E> MatcherEditor<E> weakReferenceProxy(MatcherEditor<E> matcherEditor)
This exists to solve a garbage collection problem. Suppose I have a
MatcherEditor M which is long lived and many
MatcherEditor.Listeners, t which must listen to M
while they exist. Instead of adding each of the t directly as
listeners of M, add a proxy instead. The proxy will retain a
WeakReference to the t, and will remove itself from
the list of listeners for M.
The MatcherEditor returned by this method makes implementing the
above scheme trivial. It does two things for you automatically:
MatcherEditor.Listener passed to
MatcherEditor.addMatcherEditorListener(ca.odell.glazedlists.matchers.MatcherEditor.Listener) in a
WeakReference so that the listeners are
garbage collected when they become unreachable.
matcherEditor so the MatcherEditor returned by
this method will be garbage collected when it becomes unreachable.
WeakReferencepublic static <E> Matcher<E> trueMatcher()
Matcher that always returns true, therefore matching everything.
public static <E> Matcher<E> falseMatcher()
Matcher that always returns false, therefore matching nothing..
public static <E> Matcher<E> invert(Matcher<E> original)
Matcher that returns the opposite of the specified Matcher.
public static <E> Matcher<E> beanPropertyMatcher(Class<E> beanClass,
String propertyName,
Object expectedValue)
Matcher that uses Reflection to compare the expectedValue
of the specified property of an object to the expectedValue.
public static <D extends Comparable,E> Matcher<E> rangeMatcher(D start,
D end)
Matcher that matches Comparable objects for
containment within the range between the given start
and end.
public static <D extends Comparable,E> Matcher<E> rangeMatcher(D start,
D end,
Filterator<D,E> filterator)
Matcher that uses the given filterator
to extract Comparable objects from filtered objects and compares
those Comparables against the range between the given start
and end. If at least one Comparable returned by the
filterator is within the range, the object is considered
a match.
null start or end values are
allowed and are interpreted as "no start" or
"no end" to the range respectively.
start - the Comparable which starts the rangeend - the Comparable which ends the rangefilterator - the logic for extracting filter Comparables
from filtered objects
public static <E> boolean filter(Collection<E> collection,
Matcher<? super E> matcher)
true if any elements were removed from the specified
Collection.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||