source: ether_megapoli/trunk/common/implementation/com/ether/MethodDescription.java @ 269

Last change on this file since 269 was 269, checked in by vmipsl, 13 years ago

BO User

File size: 2.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        _isJsonResult = annotation.jsonResult();
18        _isLoginMandatory = annotation.loginMandatory();
19        _isRequestMandatory = annotation.requestMandatory();
20        _isBackofficeMethod = annotation.backofficeMethod();
21        _params = new ArrayList<ParamDescription>();
22    }
23
24    public void addNullParam()
25    {
26        _params.add( null );
27    }
28
29    public void addParam( @NotNull final String paramName, @NotNull final Class<?> paramType, final boolean mandatory, final boolean usingJSON )
30    {
31        _params.add( new ParamDescription( paramName, paramType, mandatory, usingJSON ) );
32    }
33
34    @NotNull
35    public String getView()
36    {
37        return _view;
38    }
39
40    @NotNull
41    public Method getMethod()
42    {
43        return _method;
44    }
45
46    public Boolean isJsonResult()
47    {
48        return _isJsonResult;
49    }
50
51    @Nullable
52    public List<ParamDescription> getParams()
53    {
54        return _params;
55    }
56
57    public String getName()
58    {
59        return _method.getName();
60    }
61
62    @Override
63    public String toString()
64    {
65        return _method.toString();
66    }
67
68    public Boolean isLoginMandatory()
69    {
70        return _isLoginMandatory;
71    }
72
73    public void setLoginMandatory( final Boolean loginMandatory )
74    {
75        _isLoginMandatory = loginMandatory;
76    }
77
78    public Boolean isRequestMandatory()
79    {
80        return _isRequestMandatory;
81    }
82
83    public void setRequestMandatory( final Boolean requestMandatory )
84    {
85        _isRequestMandatory = requestMandatory;
86    }
87
88    public Boolean isBackofficeMethod()
89    {
90        return _isBackofficeMethod;
91    }
92
93    public void setBackofficeMethod( final Boolean backofficeMethod )
94    {
95        _isBackofficeMethod = backofficeMethod;
96    }
97
98    @NotNull
99    private Method _method;
100    @NotNull
101    private String _view;
102    private Boolean _isJsonResult;
103    @Nullable
104    private List<ParamDescription> _params;
105    private Boolean _isLoginMandatory;
106    private Boolean _isRequestMandatory;
107    private Boolean _isBackofficeMethod;
108}
Note: See TracBrowser for help on using the repository browser.