source: tapas/common/implementation/com/ether/MethodDescription.java @ 440

Last change on this file since 440 was 440, checked in by rboipsl, 12 years ago

ajout anotations
usermandatory

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