Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*  Copyright (c) 2000-2006
 package org.hamcrest;

A matcher over acceptable values. A matcher is able to describe itself to give feedback when it fails.

Matcher implementations should NOT directly implement this interface. Instead, extend the BaseMatcher abstract class, which will ensure that the Matcher API can grow to support new features and remain compatible with all Matcher implementations.

For easy access to common Matcher implementations, use the static factory methods in CoreMatchers.

See also:
public interface Matcher<T> extends SelfDescribing {

Evaluates the matcher for argument item.

This method matches against Object, instead of the generic type T. This is because the caller of the Matcher does not know at runtime what the type is (because of type erasure with Java generics). It is down to the implementations to check the correct type.

item the object against which the matcher is evaluated.
true if item matches, otherwise false.
See also:
    boolean matches(Object item);

This method simply acts a friendly reminder not to implement Matcher directly and instead extend BaseMatcher. It's easy to ignore JavaDoc, but a bit harder to ignore compile errors .

See also:
Matcher for reasons why.
New to GrepCode? Check out our FAQ X