-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathReadExcelAnnotation.java
More file actions
34 lines (25 loc) · 870 Bytes
/
ReadExcelAnnotation.java
File metadata and controls
34 lines (25 loc) · 870 Bytes
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
32
33
34
package khan.tarique;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.TreeMap;
import khan.tarique.CreateExcelAnnotation.ReadExcelSheet;
class ReadExcelAnnotation {
public static Map<String, String> extractAnnotationValue(Method method){
ReadExcelSheet fullAnnotation = method.getAnnotation(ReadExcelSheet.class);
String filePath = null;
String fileName = null;
String sheetName = null;
if(fullAnnotation instanceof ReadExcelSheet){
filePath = fullAnnotation.filePath();
fileName = fullAnnotation.fileName();
sheetName = fullAnnotation.sheetName();
}else{
System.out.println("Somthing wrong with ReadExcelSheet annotation in " +method.getName()+" method");
}
Map<String, String> map = new TreeMap<>();
map.put("filePath", filePath);
map.put("fileName", fileName);
map.put("sheetName", sheetName);
return map;
}
}