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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123 | package Torello.JavaDoc.Annotations;
import Torello.JavaDoc.Annotations.JDHeaderBackgroundImg;
import java.lang.annotation.*;
// @StaticFunctional Annotation
//
// EXPORTS:
// public Excuse[] excuses() default {};
// public String[] excused() default {};
//
// * Torello.JDUInternal.SimpleFeatures.StatelessClasses
// This class is the "Work-Horse" for the Static-Function JDU-API User-Annotation. This class
// does the actual work of inserting an HTML-Message into a Java-Doc '.html'-File which
// explains that the User wants to inform his/her user's that a particular class/type does not
// maintain any state.
/**
* <B STYLE='color:darkred;'>Java-Annotation:</B>
*
* A Java-Annotation for marking classes as 'Stateless Classes' - used to insert 'The Spaghetti
* Report' into Java Doc Pages.
*
* <EMBED CLASS='external-html' DATA-FILE-ID=STATIC_FUNC>
*/
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
public @interface StaticFunctional
{
/**
* This must contain the names of fields in this {@code class} or {@code interface} that
* have been declared {@code static}, but have not been declared {@code final}.
*
* <BR /><BR /><DIV CLASS=JDHint>
* The values in the {@code 'Excused'} array must be parallel to the values in the
* {@code 'Excuses'} array.
* </DIV>
*/
String[] Excused() default { };
/**
* This must contain instances of the Enumerated-Type {@code 'Excuses'}. These excuses
* should explain the reason why the named field has not been declared {@code 'final'} in any
* {@code class} or {@code interface} that has been marked with the {@code @StaticFunction}
* annotation.
*
* <BR /><BR /><DIV CLASS=JDHintAlt>
* The values in the {@code 'Excuses'} array must be parallel to the values in the
* {@code 'Excused'} array.
* </DIV>
*/
Excuse[] Excuses() default { };
/**
* An enumeration used by the {@link StaticFunctional} annotation for explaining
* non-{@code static} fields in a type.
*
* <BR /><BR /><EMBED CLASS='external-html' DATA-FILE-ID=EXCUSE>
*/
public enum Excuse
{
/**
* Indicates that a field inside of a class that has been decorated with the
* {@link StaticFunctional} annotation is being used as a "Configuration Flag" for that class.
*
* <EMBED CLASS='external-html' DATA-FILE-ID=EXCUSE_FLAG>
*/
FLAG,
/**
* Indicates the field isn't marked with the {@code 'final'} modifier because it is used as a
* simple-configuration.
*
* <EMBED CLASS='external-html' DATA-FILE-ID=EXCUSE_CONFIG>
*/
CONFIGURATION,
/**
* Indicates that an excused, non-{@code final}, field contains a singleton instance of a
* {@code class}, and could conceivably be changed or swapped after the class-loading phase.
*
* <EMBED CLASS='external-html' DATA-FILE-ID=EXCUSE_SINGLE>
*/
SINGLETON,
/**
* Indicates that a field is excused from the {@code 'final'} modifier because that field is
* solely used for logging purposes.
*
* <EMBED CLASS='external-html' DATA-FILE-ID=EXCUSE_LOGGING>
*/
LOGGING,
/**
* Indicates that an excused field is not marked with the {@code 'final'} modifier because it
* is intended to be used solely for debugging purposes (only!).
*
* <EMBED CLASS='external-html' DATA-FILE-ID=EXCUSE_DEBUG>
*/
DEBUGGING,
/**
* Indicates that a field inside of a class annotated by {@code StaticFunctional}, is
* non-{@code final} because the field's value isn't actually loaded at class-initialization
* time by the {@code ClassLoader}.
*
* <EMBED CLASS='external-html' DATA-FILE-ID=EXCUSE_LAZY_LD>
*/
LAZY_LOADING,
/**
* Since ensuring that the Garbage-Collector runs does not constitute program state, this excuse
* is provided for any field that doesn't declare the {@code 'final'} modifier because it is
* involved in calls to {@code System.gc()}.
*
* <EMBED CLASS='external-html' DATA-FILE-ID=EXCUSE_GARBAGE>
*/
GARBAGE_COLLECTION;
}
}
|