1
2
3
4 package com.lexicalscope.fluentreflection;
5
6 import org.hamcrest.Description;
7
8 final class MatcherAssignableFrom extends ReflectionMatcher<FluentClass<?>> {
9 private final Class<?> klass;
10
11 MatcherAssignableFrom(final Class<?> klass) {
12 this.klass = klass;
13 }
14
15 public MatcherAssignableFrom(final FluentClass<?> klass) {
16 this(klass.classUnderReflection());
17 }
18
19 @Override
20 public boolean matchesSafely(final FluentClass<?> arg) {
21 return arg.classUnderReflection().isAssignableFrom(klass);
22 }
23
24 @Override
25 public void describeTo(final Description description) {
26 description.appendText("type assignable from ").appendValue(klass);
27 }
28 }