-
Notifications
You must be signed in to change notification settings - Fork 5
/
MiniREST.Attribute.pas
54 lines (43 loc) · 1.43 KB
/
MiniREST.Attribute.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
unit MiniREST.Attribute;
interface
uses MiniREST.Common, IdCustomHttpServer;
type
RequestMappingAttribute = class(TCustomAttribute)
private
FMapping : string;
FRequestMethod : TMiniRESTRequestMethod;
FPermission : string;
public
constructor Create(AMapping : string; APermission : string = ''; ARequestMethod : TMiniRESTRequestMethod = rmGet); overload;
constructor Create(AMapping : string; ARequestMethod : TMiniRESTRequestMethod); overload;
property Mapping : string read FMapping;
property RequestMethod : TMiniRESTRequestMethod read FRequestMethod;
property Permission : string read FPermission;
end;
RequestMappingDesctriptionAttribute = class(TCustomAttribute)
private
FDescription: string;
public
constructor Create(ADescription: string);
property Description: string read FDescription;
end;
implementation
{ RequestMappingAttribute }
constructor RequestMappingAttribute.Create(AMapping: string; APermission : string;
ARequestMethod: TMiniRESTRequestMethod);
begin
FMapping := AMapping;
FRequestMethod := ARequestMethod;
FPermission := APermission;
end;
constructor RequestMappingAttribute.Create(AMapping: string;
ARequestMethod: TMiniRESTRequestMethod);
begin
Create(AMapping, '', ARequestMethod);
end;
{ RequestMappingDesctriptionAttribute }
constructor RequestMappingDesctriptionAttribute.Create(ADescription: string);
begin
FDescription := ADescription;
end;
end.