-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
zcl_swag_example_handler.clas.abap
51 lines (34 loc) · 1.04 KB
/
zcl_swag_example_handler.clas.abap
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
CLASS zcl_swag_example_handler DEFINITION
PUBLIC
CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES zif_swag_handler.
TYPES:
BEGIN OF ty_structure,
foo TYPE string,
bar TYPE string,
END OF ty_structure.
METHODS the_real_stuff
IMPORTING
!iv_foo TYPE string DEFAULT `Moo`
!iv_bar TYPE string OPTIONAL
RETURNING
VALUE(rs_data) TYPE ty_structure.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_SWAG_EXAMPLE_HANDLER IMPLEMENTATION.
METHOD the_real_stuff.
CONCATENATE iv_foo iv_bar INTO rs_data-foo.
rs_data-bar = iv_bar.
ENDMETHOD.
METHOD zif_swag_handler~meta.
FIELD-SYMBOLS: <ls_meta> LIKE LINE OF rt_meta.
APPEND INITIAL LINE TO rt_meta ASSIGNING <ls_meta>.
<ls_meta>-summary = 'this is the description'(001).
<ls_meta>-url-regex = '/swag/(\w*)/'.
APPEND 'IV_FOO' TO <ls_meta>-url-group_names.
<ls_meta>-method = zcl_swag=>c_method-get.
<ls_meta>-handler = 'THE_REAL_STUFF'.
ENDMETHOD.
ENDCLASS.