* * *

|  [ **Overview** ](../../overview-summary.html) |  [ **Package** ](package-summary.html) |  **Class** |  [ **Use** ](class-use/CustomMatcher.html) |  [ **Tree** ](package-tree.html) |  [ **Deprecated** ](../../deprecated-list.html) |  [ **Index** ](../../index-all.html) |  [ **Help** ](../../help-doc.html)  
---|---|---|---|---|---|---|---  
__  
[ **PREV CLASS** ](../../org/hamcrest/CoreMatchers.html "class in org.hamcrest") [ **NEXT CLASS** ](../../org/hamcrest/CustomTypeSafeMatcher.html "class in org.hamcrest") |  [ **FRAMES** ](../../index.html?org/hamcrest/CustomMatcher.html) [ **NO FRAMES** ](CustomMatcher.html) [ **All Classes** ](../../allclasses-noframe.html)  
SUMMARY: NESTED | FIELD |  CONSTR  |  METHOD  |  DETAIL: FIELD |  CONSTR  |  METHOD   
  
* * *

##  org.hamcrest  
Class CustomMatcher<T>

    
    
    java.lang.Object
      ![extended by ](../../resources/inherit.gif)[org.hamcrest.BaseMatcher](../../org/hamcrest/BaseMatcher.html "class in org.hamcrest")<T>
          ![extended by ](../../resources/inherit.gif)**org.hamcrest.CustomMatcher <T>**
    

**Type Parameters:**      ` T ` \- The type of object being matched.

**All Implemented Interfaces:**      [ Matcher
](../../org/hamcrest/Matcher.html "interface in org.hamcrest") <T>, [
SelfDescribing ](../../org/hamcrest/SelfDescribing.html "interface in
org.hamcrest")

* * *
    
    
    public abstract class **CustomMatcher <T>**extends [BaseMatcher](../../org/hamcrest/BaseMatcher.html "class in org.hamcrest")<T>

Utility class for writing one off matchers. For example:

    
    
     Matcher<String> aNonEmptyString = new CustomMatcher<String>("a non empty string") {
       public boolean matches(Object object) {
         return ((object instanceof String) && !((String) object).isEmpty();
       }
     };
     

This class is designed for scenarios where an anonymous inner class matcher
makes sense. It should not be used by API designers implementing matchers.

**Author:**

     Neil Dunn 
**See Also:**      [ ` for a type safe variant of this class that you probably
want to use. ` ](../../org/hamcrest/CustomTypeSafeMatcher.html "class in
org.hamcrest")

* * *

**Constructor Summary**  
---  
` **[ CustomMatcher
](../../org/hamcrest/CustomMatcher.html#CustomMatcher\(java.lang.String\)) **
(java.lang.String description) `  
  
**Method Summary**  
---  
` void ` |  ` **[ describeTo ](../../org/hamcrest/CustomMatcher.html#describeTo\(org.hamcrest.Description\)) ** ( [ Description ](../../org/hamcrest/Description.html "interface in org.hamcrest") description) `   
Generates a description of the object.  
**Methods inherited from class org.hamcrest.[ BaseMatcher
](../../org/hamcrest/BaseMatcher.html "class in org.hamcrest") **  
---  
` [ _dont_implement_Matcher___instead_extend_BaseMatcher_
](../../org/hamcrest/BaseMatcher.html#_dont_implement_Matcher___instead_extend_BaseMatcher_\(\))
, [ describeMismatch
](../../org/hamcrest/BaseMatcher.html#describeMismatch\(java.lang.Object,
org.hamcrest.Description\)) , [ toString
](../../org/hamcrest/BaseMatcher.html#toString\(\)) `  
**Methods inherited from class java.lang.Object**  
---  
` clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait,
wait `  
**Methods inherited from interface org.hamcrest.[ Matcher
](../../org/hamcrest/Matcher.html "interface in org.hamcrest") **  
---  
` [ matches ](../../org/hamcrest/Matcher.html#matches\(java.lang.Object\)) `  
  
**Constructor Detail**  
---  
  
###  CustomMatcher

    
    
    public **CustomMatcher**(java.lang.String description)

**Method Detail**  
---  
  
###  describeTo

    
    
    public final void **describeTo**([Description](../../org/hamcrest/Description.html "interface in org.hamcrest") description)

     **Description copied from interface:` [ SelfDescribing ](../../org/hamcrest/SelfDescribing.html#describeTo\(org.hamcrest.Description\)) ` **
     Generates a description of the object. The description may be part of a a