View Javadoc

1   /**
2    *
3    */
4   package com.lexicalscope.fluentreflection;
5   
6   import org.hamcrest.Description;
7   import org.hamcrest.Matcher;
8   
9   final class MatcherDeclaredBy extends ReflectionMatcher<FluentMember> {
10      private final Matcher<? super FluentClass<?>> declaringKlassMatcher;
11  
12      MatcherDeclaredBy(final Matcher<? super FluentClass<?>> declaringKlassMatcher) {
13          this.declaringKlassMatcher = declaringKlassMatcher;
14      }
15  
16      @Override public boolean matchesSafely(final FluentMember arg) {
17          return declaringKlassMatcher.matches(arg.declarer());
18      }
19  
20      @Override public void describeTo(final Description description) {
21          description.appendText("callable declared by ").appendDescriptionOf(declaringKlassMatcher);
22      }
23  }