1 | 24 | |
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 | 32 | MatcherHasInterface(final Class<?> interfac3) { |
16 | 32 | this.interfac3 = interfac3; |
17 | 32 | } |
18 | |
|
19 | |
@Override |
20 | |
public boolean matchesSafely(final FluentClass<?> arg) { |
21 | 48 | return !select( |
22 | 24 | arg.interfaces(), |
23 | 48 | reflectingOn(interfac3)).isEmpty(); |
24 | |
} |
25 | |
|
26 | |
@Override |
27 | |
public void describeTo(final Description description) { |
28 | 8 | description.appendText("type that implements interface ").appendValue(interfac3); |
29 | 8 | } |
30 | |
} |