1 package com.lexicalscope.fluentreflection;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import static com.lexicalscope.fluentreflection.MatcherAnd.andOf;
20 import static com.lexicalscope.fluentreflection.MatcherOr.orOf;
21
22 import java.util.ArrayList;
23 import java.util.List;
24
25 import org.hamcrest.Matcher;
26 import org.hamcrest.TypeSafeMatcher;
27
28
29
30
31
32
33
34
35 public abstract class ReflectionMatcher<T> extends TypeSafeMatcher<T> {
36
37
38
39
40
41
42
43
44 public ReflectionMatcher<T> and(final Matcher<? super T> matcher) {
45 final List<Matcher<? super T>> list = new ArrayList<Matcher<? super T>>();
46 list.add(this);
47 list.add(matcher);
48 return andOf(list);
49 }
50
51
52
53
54
55
56
57
58
59 public ReflectionMatcher<T> or(final Matcher<? super T> matcher) {
60 final List<Matcher<? super T>> list = new ArrayList<Matcher<? super T>>();
61 list.add(this);
62 list.add(matcher);
63 return orOf(list);
64 }
65
66 static <T> Matcher<T> allOf(
67 final Matcher<? super T> T0,
68 final Matcher<? super T> T1) {
69 final List<Matcher<? super T>> list = new ArrayList<Matcher<? super T>>();
70 list.add(T0);
71 list.add(T1);
72 return andOf(list);
73 }
74 }