source: ether_statistics/common/implementation/com/ether/MethodDescription.java @ 569

Last change on this file since 569 was 569, checked in by vmipsl, 12 years ago

Nouveau projet

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