1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package jp.liq.container.reflect;
17
18 import java.lang.reflect.Method;
19 import java.util.Iterator;
20
21 import jp.liq.container.util.ArrayIterator;
22 import jp.liq.container.util.IteratorWrapper;
23
24
25
26
27
28
29 public class ClassMethodFinder<T> extends MemberFinder<MethodWrapper, ClassMethodFinder<T>>
30 implements Iterable<MethodWrapper> {
31
32 private final Class<T> ownerClass;
33
34
35
36
37
38 public ClassMethodFinder(Class<T> ownerClass) {
39 this.ownerClass = ownerClass;
40 }
41
42 @Override
43 protected ClassMethodFinder<T> getThis() {
44 return this;
45 }
46
47
48
49
50 public Class<T> getOwnerClass() {
51 return ownerClass;
52 }
53
54 @Override
55 protected Iterator<MethodWrapper> getCandidates() {
56 return new MethodWrapperIterator(
57 new ArrayIterator<Method>(ownerClass.getMethods()));
58 }
59
60 private class MethodWrapperIterator extends IteratorWrapper<MethodWrapper, Method> {
61 public MethodWrapperIterator(Iterator<Method> iterator) {
62 super(iterator);
63 }
64
65 public MethodWrapper next() {
66 return new MethodWrapper(iterator.next());
67 }
68
69 }
70 }