-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAnnotation_For_Annotaion_example.txt
executable file
·59 lines (50 loc) · 1.84 KB
/
Annotation_For_Annotaion_example.txt
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
55
56
57
Пример объявления Annotation for Annotation
( то есть сначала нужно получить getClass().getAnnotation(),
а уже потом на основании данного Annotation#telegrams )
=============
Class with annotation
=============
@TelgraphSpec( telegrams = { @TelegramSpec( name=TelegraphConstants.TELEGRAM.NAME_LOGIN_LOGOFF,
description = "login logout",
arguments = {
@TelegramArgSpec( name = "userlogin",
type = String.class ),
@TelegramArgSpec( name = "action",
type = String.class )
} )
}
)
public class Logon implements ILogon, Serializable {
---------------------------------------------------------------------------------------------------------
=============
Annotation
=============
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface TelgraphSpec {
public TelegramSpec[] telegrams();
}
---------------------------------------------------------------------------------------------------------
=============
Annotation
=============
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface TelegramSpec {
/**
* Telegram name exactly defines both particular configured route and subscribers
* @return Telegram name exactly defines both particular configured route and subscribers
*/
public String name();
/**
* Some additional custom explonation of this telegram
* @return Some additional custom explonation of this telegram
*/
public String description() default "";
/**
* List of telegram arguments
* @return List of telegram arguments
*/
public TelegramArgSpec[] arguments();
}
---------------------------------------------------------------------------------------------------------