-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Mappings.java
31 lines (25 loc) · 1.01 KB
/
Mappings.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package me.nallar.tickthreading.mappings;
import java.util.ArrayList;
import java.util.List;
public abstract class Mappings {
@SuppressWarnings ("unchecked")
public List map(List things) {
List mappedThings = new ArrayList();
for (Object thing : things) {
if (thing instanceof MethodDescription) {
mappedThings.add(map((MethodDescription) thing));
} else if (thing instanceof ClassDescription) {
mappedThings.add(map((ClassDescription) thing));
} else if (thing instanceof FieldDescription) {
mappedThings.add(map((FieldDescription) thing));
} else {
throw new IllegalArgumentException("Must be mappable: " + thing + "isn't!");
}
}
return mappedThings;
}
public abstract MethodDescription map(MethodDescription methodDescription);
public abstract ClassDescription map(ClassDescription classDescription);
public abstract FieldDescription map(FieldDescription fieldDescription);
public abstract MethodDescription rmap(MethodDescription methodDescription);
}