Table of Contents

Class Matchers

Namespace
Quartz
Assembly
Quartz.dll

The entry point for building matchers: the roots live here as static factories, and the combinators — And<TKey>(IMatcher<TKey>, IMatcher<TKey>), Or<TKey>(IMatcher<TKey>, IMatcher<TKey>) and Not<TKey>(IMatcher<TKey>) — are extension methods on any IMatcher<T>, so an expression reads left to right:

public static class Matchers
Inheritance
Matchers
Inherited Members

Examples

IMatcher<JobKey> matcher = Matchers.Group<JobKey>(StringOperator.StartsWith, "reporting")
    .And(Matchers.Name<JobKey>(StringOperator.Contains, "cleanup"))
    .Not();

Remarks

GroupMatcher<TKey> and NameMatcher<TKey> also carry factories of their own — GroupEquals, NameStartsWith, … — and that split is deliberate rather than an unfinished move. The two answer different questions. A factory on the concrete type names its comparison, so a call site that knows which comparison it wants reads as a sentence and returns the concrete type the scheduler members that take a GroupMatcher<TKey> require. The roots here take the comparison as a StringOperator value, which is what a caller who read the operator from configuration, from a query string or off the wire actually holds — the HTTP API builds every matcher it receives this way — and there is no way to spell that with a method per operator.

What does not live on a concrete type is a root that names no comparison: AllJobs(), AllTriggers() and Key(JobKey) have nothing to name themselves after, so they are built here and nowhere else.

Methods

AllJobs()

A matcher that matches every job.

public static EverythingMatcher<JobKey> AllJobs()

Returns

EverythingMatcher<JobKey>

AllTriggers()

A matcher that matches every trigger.

public static EverythingMatcher<TriggerKey> AllTriggers()

Returns

EverythingMatcher<TriggerKey>

And<TKey>(IMatcher<TKey>, IMatcher<TKey>)

A matcher that matches when both this matcher and other match.

public static AndMatcher<TKey> And<TKey>(this IMatcher<TKey> matcher, IMatcher<TKey> other) where TKey : Key<TKey>

Parameters

matcher IMatcher<TKey>
other IMatcher<TKey>

Returns

AndMatcher<TKey>

Type Parameters

TKey

Group<TKey>(StringOperator, string)

A matcher that compares the group of a key with the given value.

public static GroupMatcher<TKey> Group<TKey>(StringOperator matchOperator, string compareTo) where TKey : Key<TKey>

Parameters

matchOperator StringOperator

How to compare, e.g. Equality or StartsWith.

compareTo string

The value to compare the group with.

Returns

GroupMatcher<TKey>

Type Parameters

TKey

Which kind of key to match: JobKey or TriggerKey.

Key(JobKey)

A matcher that matches exactly the job with the given key.

public static KeyMatcher<JobKey> Key(JobKey key)

Parameters

key JobKey

Returns

KeyMatcher<JobKey>

Key(TriggerKey)

A matcher that matches exactly the trigger with the given key.

public static KeyMatcher<TriggerKey> Key(TriggerKey key)

Parameters

key TriggerKey

Returns

KeyMatcher<TriggerKey>

Name<TKey>(StringOperator, string)

A matcher that compares the name of a key with the given value.

public static NameMatcher<TKey> Name<TKey>(StringOperator matchOperator, string compareTo) where TKey : Key<TKey>

Parameters

matchOperator StringOperator

How to compare, e.g. Equality or StartsWith.

compareTo string

The value to compare the name with.

Returns

NameMatcher<TKey>

Type Parameters

TKey

Which kind of key to match: JobKey or TriggerKey.

Not<TKey>(IMatcher<TKey>)

A matcher that matches when this matcher does not.

public static NotMatcher<TKey> Not<TKey>(this IMatcher<TKey> matcher) where TKey : Key<TKey>

Parameters

matcher IMatcher<TKey>

Returns

NotMatcher<TKey>

Type Parameters

TKey

Or<TKey>(IMatcher<TKey>, IMatcher<TKey>)

A matcher that matches when this matcher, other, or both match.

public static OrMatcher<TKey> Or<TKey>(this IMatcher<TKey> matcher, IMatcher<TKey> other) where TKey : Key<TKey>

Parameters

matcher IMatcher<TKey>
other IMatcher<TKey>

Returns

OrMatcher<TKey>

Type Parameters

TKey

See Also