1 | package com.ether; |
---|
2 | |
---|
3 | import com.ether.annotation.ControllerMethod; |
---|
4 | import org.jetbrains.annotations.NotNull; |
---|
5 | import org.jetbrains.annotations.Nullable; |
---|
6 | |
---|
7 | import java.lang.reflect.Method; |
---|
8 | import java.util.ArrayList; |
---|
9 | import java.util.List; |
---|
10 | |
---|
11 | public class MethodDescription |
---|
12 | { |
---|
13 | MethodDescription( @NotNull final Method method, @NotNull final ControllerMethod annotation ) |
---|
14 | { |
---|
15 | _method = method; |
---|
16 | _view = annotation.view(); |
---|
17 | _defaultView = annotation.defaultView(); |
---|
18 | _isJsonResult = annotation.jsonResult(); |
---|
19 | _isLoginMandatory = annotation.loginMandatory(); |
---|
20 | _isRequestMandatory = annotation.requestMandatory(); |
---|
21 | _isBackofficeMethod = annotation.backofficeMethod(); |
---|
22 | _params = new ArrayList<ParamDescription>(); |
---|
23 | _downloadFile = annotation.downloadFile(); |
---|
24 | } |
---|
25 | |
---|
26 | public void addNullParam() |
---|
27 | { |
---|
28 | _params.add( null ); |
---|
29 | } |
---|
30 | |
---|
31 | public void addParam( @NotNull final String paramName, @NotNull final Class<?> paramType, final boolean mandatory, final boolean usingJSON ) |
---|
32 | { |
---|
33 | _params.add( new ParamDescription( paramName, paramType, mandatory, usingJSON ) ); |
---|
34 | } |
---|
35 | |
---|
36 | @NotNull |
---|
37 | public String getView() |
---|
38 | { |
---|
39 | return _view; |
---|
40 | } |
---|
41 | |
---|
42 | public void setView( @NotNull final String view ) |
---|
43 | { |
---|
44 | _view = view; |
---|
45 | } |
---|
46 | |
---|
47 | @Nullable |
---|
48 | public String getDefaultView() |
---|
49 | { |
---|
50 | return _defaultView; |
---|
51 | } |
---|
52 | |
---|
53 | public void setDefaultView( @Nullable final String defaultView ) |
---|
54 | { |
---|
55 | _defaultView = defaultView; |
---|
56 | } |
---|
57 | |
---|
58 | @NotNull |
---|
59 | public Method getMethod() |
---|
60 | { |
---|
61 | return _method; |
---|
62 | } |
---|
63 | |
---|
64 | public Boolean isJsonResult() |
---|
65 | { |
---|
66 | return _isJsonResult; |
---|
67 | } |
---|
68 | |
---|
69 | @Nullable |
---|
70 | public List<ParamDescription> getParams() |
---|
71 | { |
---|
72 | return _params; |
---|
73 | } |
---|
74 | |
---|
75 | public String getName() |
---|
76 | { |
---|
77 | return _method.getName(); |
---|
78 | } |
---|
79 | |
---|
80 | @Override |
---|
81 | public String toString() |
---|
82 | { |
---|
83 | return _method.toString(); |
---|
84 | } |
---|
85 | |
---|
86 | public Boolean isLoginMandatory() |
---|
87 | { |
---|
88 | return _isLoginMandatory; |
---|
89 | } |
---|
90 | |
---|
91 | public void setLoginMandatory( final Boolean loginMandatory ) |
---|
92 | { |
---|
93 | _isLoginMandatory = loginMandatory; |
---|
94 | } |
---|
95 | |
---|
96 | public Boolean isRequestMandatory() |
---|
97 | { |
---|
98 | return _isRequestMandatory; |
---|
99 | } |
---|
100 | |
---|
101 | public void setRequestMandatory( final Boolean requestMandatory ) |
---|
102 | { |
---|
103 | _isRequestMandatory = requestMandatory; |
---|
104 | } |
---|
105 | |
---|
106 | public Boolean isBackofficeMethod() |
---|
107 | { |
---|
108 | return _isBackofficeMethod; |
---|
109 | } |
---|
110 | |
---|
111 | public void setBackofficeMethod( final Boolean backofficeMethod ) |
---|
112 | { |
---|
113 | _isBackofficeMethod = backofficeMethod; |
---|
114 | } |
---|
115 | |
---|
116 | @Nullable |
---|
117 | public String getDownloadFile() |
---|
118 | { |
---|
119 | return _downloadFile; |
---|
120 | } |
---|
121 | |
---|
122 | public void setDownloadFile( @Nullable final String downloadFile ) |
---|
123 | { |
---|
124 | _downloadFile = downloadFile; |
---|
125 | } |
---|
126 | |
---|
127 | @NotNull |
---|
128 | private Method _method; |
---|
129 | @NotNull |
---|
130 | private String _view; |
---|
131 | @Nullable |
---|
132 | private String _defaultView; |
---|
133 | private Boolean _isJsonResult; |
---|
134 | @Nullable |
---|
135 | private List<ParamDescription> _params; |
---|
136 | private Boolean _isLoginMandatory; |
---|
137 | private Boolean _isRequestMandatory; |
---|
138 | private Boolean _isBackofficeMethod; |
---|
139 | @Nullable |
---|
140 | private String _downloadFile; |
---|
141 | } |
---|