01: package tide.syntaxtree;
02:
03: import javaparser.*;
04: import tide.editor.*;
05: import japa.parser.*;
06: import tide.sources.*;
07: import snow.concurrent.*;
08: import snow.utils.gui.*;
09: import java.util.*;
10: import java.io.*;
11:
12: public final class SearchFunctions {
13: private SearchFunctions() {
14: }
15:
16: /** null if not found
17: */
18: @edu.umd.cs.findbugs.annotations.CheckForNull
19: public static String searchTypeForMethodOrField(String name,
20: TypeNode from, boolean includeMethods, boolean includeFields) {
21: if (includeMethods) {
22: List<MethodNode> lm = new ArrayList<MethodNode>();
23: Utils.getAllMethods(from, lm);
24: for (MethodNode mn : lm) {
25: if (mn.name.equals(name))
26: return mn.resultType;
27: }
28: }
29:
30: if (includeFields) {
31: List<FieldNode> lm = new ArrayList<FieldNode>();
32: Utils.getAllFields(from, lm);
33: for (FieldNode mn : lm) {
34: if (mn.name.equals(name))
35: return mn.type;
36: }
37: }
38:
39: return null;
40: }
41:
42: }
|