View Javadoc

1   /**
2    * 
3    */
4   package com.lexicalscope.fluentreflection;
5   
6   import static ch.lambdaj.Lambda.select;
7   import static com.lexicalscope.fluentreflection.ReflectionMatchers.reflectingOn;
8   
9   import org.hamcrest.Description;
10  
11  
12  final class MatcherHasInterface extends ReflectionMatcher<FluentClass<?>> {
13      private final Class<?> interfac3;
14  
15      MatcherHasInterface(final Class<?> interfac3) {
16          this.interfac3 = interfac3;
17      }
18  
19      @Override
20      public boolean matchesSafely(final FluentClass<?> arg) {
21          return !select(
22                  arg.interfaces(),
23                  reflectingOn(interfac3)).isEmpty();
24      }
25  
26      @Override
27      public void describeTo(final Description description) {
28          description.appendText("type that implements interface ").appendValue(interfac3);
29      }
30  }