1
2
3
4
5 package gboat2.base.core.web.md;
6
7 import gboat2.base.core.util.ActionUtil;
8 import gboat2.base.core.web.BaseActionSupport;
9
10 import java.lang.reflect.Method;
11
12 import org.apache.commons.lang3.StringUtils;
13 import org.osgi.framework.Bundle;
14
15
16
17
18
19
20
21
22
23 public class ExtendMethodHandler implements IFileFilter {
24
25 @Override
26 public String getFile(String invokeMethod, BaseActionSupport action, Bundle bundle) {
27 String filePath = null;
28 try {
29 Method method = action.getClass().getMethod("getExtendForView", new Class[] {});
30 String extend = (String) method.invoke(action, new Object[] {});
31 if (!StringUtils.isEmpty(extend)) {
32 filePath = ActionUtil.getPathPrefix(action.getClass()) + "/metadata/" + action.getUriPrefix() + "-" + invokeMethod + "-" + extend
33 + ".md";
34 }
35 } catch (Exception ignore) {
36
37 }
38 return filePath;
39 }
40
41 }