* * *

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

##  org.hamcrest.beans  
Class HasProperty<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.TypeSafeMatcher](../../../org/hamcrest/TypeSafeMatcher.html "class in org.hamcrest")<T>
              ![extended by ](../../../resources/inherit.gif)**org.hamcrest.beans.HasProperty <T>**
    

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

* * *
    
    
    public class **HasProperty <T>**extends [TypeSafeMatcher](../../../org/hamcrest/TypeSafeMatcher.html "class in org.hamcrest")<T>

A Matcher that checks that an object has a JavaBean property with the
specified name. If an error occurs during introspection of the object then
this is treated as a mismatch.

**Author:**

     Iain McGinniss, Nat Pryce, Steve Freeman 

* * *

**Constructor Summary**  
---  
` **[ HasProperty
](../../../org/hamcrest/beans/HasProperty.html#HasProperty\(java.lang.String\))
** (java.lang.String propertyName) `  
  
**Method Summary**  
---  
` void ` |  ` **[ describeMismatchSafely ](../../../org/hamcrest/beans/HasProperty.html#describeMismatchSafely\(T, org.hamcrest.Description\)) ** ( [ T ](../../../org/hamcrest/beans/HasProperty.html "type parameter in HasProperty") item, [ Description ](../../../org/hamcrest/Description.html "interface in org.hamcrest") mismatchDescription) `   
Subclasses should override this.  
` void ` |  ` **[ describeTo ](../../../org/hamcrest/beans/HasProperty.html#describeTo\(org.hamcrest.Description\)) ** ( [ Description ](../../../org/hamcrest/Description.html "interface in org.hamcrest") description) `   
Generates a description of the object.  
` static  |  ` <T> [ Matcher ](../../../org/hamcrest/Matcher.html "interface in org.hamcrest") <T> `  
---  
` ` **[ hasProperty
](../../../org/hamcrest/beans/HasProperty.html#hasProperty\(java.lang.String\))
** (java.lang.String propertyName) `  
Creates a matcher that matches when the examined object has a JavaBean
property with the specified name.  
` boolean ` |  ` **[ matchesSafely ](../../../org/hamcrest/beans/HasProperty.html#matchesSafely\(T\)) ** ( [ T ](../../../org/hamcrest/beans/HasProperty.html "type parameter in HasProperty") obj) `   
Subclasses should implement this.  
**Methods inherited from class org.hamcrest.[ TypeSafeMatcher
](../../../org/hamcrest/TypeSafeMatcher.html "class in org.hamcrest") **  
---  
` [ describeMismatch
](../../../org/hamcrest/TypeSafeMatcher.html#describeMismatch\(java.lang.Object,
org.hamcrest.Description\)) , [ matches
](../../../org/hamcrest/TypeSafeMatcher.html#matches\(java.lang.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_\(\))
, [ toString ](../../../org/hamcrest/BaseMatcher.html#toString\(\)