Class TypeSafeMatcher<T>

  • All Implemented Interfaces:
    org.hamcrest.Matcher<T>, org.hamcrest.SelfDescribing

    @Deprecated
    public abstract class TypeSafeMatcher<T>
    extends org.hamcrest.BaseMatcher<T>
    Deprecated.
    Please use TypeSafeMatcher.
    Convenient base class for Matchers that require a non-null value of a specific type. This simply implements the null check, checks the type and then casts.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Class<?> expectedType
      Deprecated.
       
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected TypeSafeMatcher()
      Deprecated.
       
      protected TypeSafeMatcher​(java.lang.Class<T> expectedType)
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      private static java.lang.Class<?> findExpectedType​(java.lang.Class<?> fromClass)
      Deprecated.
       
      private static boolean isMatchesSafelyMethod​(java.lang.reflect.Method method)
      Deprecated.
       
      boolean matches​(java.lang.Object item)
      Deprecated.
      Method made final to prevent accidental override.
      abstract boolean matchesSafely​(T item)
      Deprecated.
      Subclasses should implement this.
      • Methods inherited from class org.hamcrest.BaseMatcher

        _dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, isNotNull, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.hamcrest.SelfDescribing

        describeTo
    • Field Detail

      • expectedType

        private java.lang.Class<?> expectedType
        Deprecated.
    • Constructor Detail

      • TypeSafeMatcher

        protected TypeSafeMatcher()
        Deprecated.
      • TypeSafeMatcher

        protected TypeSafeMatcher​(java.lang.Class<T> expectedType)
        Deprecated.
    • Method Detail

      • matchesSafely

        public abstract boolean matchesSafely​(T item)
        Deprecated.
        Subclasses should implement this. The item will already have been checked for the specific type and will never be null.
      • findExpectedType

        private static java.lang.Class<?> findExpectedType​(java.lang.Class<?> fromClass)
        Deprecated.
      • isMatchesSafelyMethod

        private static boolean isMatchesSafelyMethod​(java.lang.reflect.Method method)
        Deprecated.
      • matches

        public final boolean matches​(java.lang.Object item)
        Deprecated.
        Method made final to prevent accidental override. If you need to override this, there's no point on extending TypeSafeMatcher. Instead, extend the BaseMatcher.