-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain2.java
More file actions
22 lines (19 loc) · 788 Bytes
/
Copy pathMain2.java
File metadata and controls
22 lines (19 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.company;
import jdk.nashorn.internal.objects.NativeDebug;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class Main2 {
public static void main(String[] args) throws InvocationTargetException, IllegalAccessException {
TextContainer container = new TextContainer();
Class<?> cls = container.getClass();
if (cls.isAnnotationPresent(SaveTo.class)) {
String path = cls.getAnnotation(SaveTo.class).path();
Method[] methods = cls.getDeclaredMethods();
for (Method method : methods) {
if (method.isAnnotationPresent(Saver.class)) {
method.invoke(container, path);
}
}
}
}
}