1
- # Javadoc 编写示例
1
+ = Javadoc 编写示例
2
2
3
+ == 包
3
4
4
- ## openJDK jdk8-b120
5
+ === java.lang.package-info
5
6
6
- java.util.ArrayList.java
7
+ * link:https://github.com/openjdk/jdk/tree/jdk8-b120[openJDK jdk8-b120]
8
+ * link:https://github.com/openjdk/jdk/blob/jdk8-b120/jdk/src/share/classes/java/lang/package-info.java[java.lang.package-info.java]
9
+
10
+ [source,java]
11
+ ....
12
+ /**
13
+ * Provides classes that are fundamental to the design of the Java
14
+ * programming language. The most important classes are {@code
15
+ * Object}, which is the root of the class hierarchy, and {@code
16
+ * Class}, instances of which represent classes at run time.
17
+ *
18
+ * <p>Frequently it is necessary to represent a value of primitive
19
+ * type as if it were an object. The wrapper classes {@code Boolean},
20
+ * {@code Character}, {@code Integer}, {@code Long}, {@code Float},
21
+ * and {@code Double} serve this purpose. An object of type {@code
22
+ * Double}, for example, contains a field whose type is double,
23
+ * representing that value in such a way that a reference to it can be
24
+ * stored in a variable of reference type. These classes also provide
25
+ * a number of methods for converting among primitive values, as well
26
+ * as supporting such standard methods as equals and hashCode. The
27
+ * {@code Void} class is a non-instantiable class that holds a
28
+ * reference to a {@code Class} object representing the type void.
29
+ *
30
+ * <p>The class {@code Math} provides commonly used mathematical
31
+ * functions such as sine, cosine, and square root. The classes {@code
32
+ * String}, {@code StringBuffer}, and {@code StringBuilder} similarly
33
+ * provide commonly used operations on character strings.
34
+ *
35
+ * <p>Classes {@code ClassLoader}, {@code Process}, {@code
36
+ * ProcessBuilder}, {@code Runtime}, {@code SecurityManager}, and
37
+ * {@code System} provide "system operations" that manage the dynamic
38
+ * loading of classes, creation of external processes, host
39
+ * environment inquiries such as the time of day, and enforcement of
40
+ * security policies.
41
+ *
42
+ * <p>Class {@code Throwable} encompasses objects that may be thrown
43
+ * by the {@code throw} statement. Subclasses of {@code Throwable}
44
+ * represent errors and exceptions.
45
+ *
46
+ * <a name="charenc"></a>
47
+ * <h3>Character Encodings</h3>
48
+ *
49
+ * The specification of the {@link java.nio.charset.Charset
50
+ * java.nio.charset.Charset} class describes the naming conventions
51
+ * for character encodings as well as the set of standard encodings
52
+ * that must be supported by every implementation of the Java
53
+ * platform.
54
+ *
55
+ * @since JDK1.0
56
+ */
57
+ package java.lang;
58
+ ....
59
+
60
+ == 类
61
+
62
+ === java.lang.Object
63
+
64
+ * link:https://github.com/openjdk/jdk/tree/jdk8-b120[openJDK jdk8-b120]
65
+ * link:https://github.com/openjdk/jdk/blob/jdk8-b120/jdk/src/share/classes/java/lang/Object.java[java.lang.Object.java]
66
+
67
+ [source,java]
68
+ ....
69
+ /**
70
+ * Class {@code Object} is the root of the class hierarchy.
71
+ * Every class has {@code Object} as a superclass. All objects,
72
+ * including arrays, implement the methods of this class.
73
+ *
74
+ * @author unascribed
75
+ * @see java.lang.Class
76
+ * @since JDK1.0
77
+ */
78
+ public class Object {
79
+
80
+ private static native void registerNatives();
81
+ static {
82
+ registerNatives();
83
+ }
84
+ // ......
85
+ // ......
86
+ }
87
+ ....
88
+
89
+ == 方法
90
+
91
+ === ArrayList#contains
92
+
93
+ * link:https://github.com/openjdk/jdk/tree/jdk8-b120[openJDK jdk8-b120]
94
+ * link:https://github.com/openjdk/jdk/blob/jdk8-b120/jdk/src/share/classes/java/util/ArrayList.java#L284[java.util.ArrayList#contains]
7
95
8
96
[source,java]
9
97
....
@@ -22,10 +110,10 @@ public boolean contains(Object o) {
22
110
....
23
111
24
112
113
+ === StringUtils#isEmpty
25
114
26
- ## org.apache.commons:commons-lang3:3.13.0
27
-
28
- org.apache.commons.lang3.StringUtils.java
115
+ * link:https://github.com/apache/commons-lang/tree/rel/commons-lang-3.13.0[org.apache.commons:commons-lang3:3.13.0]
116
+ * link:https://github.com/apache/commons-lang/blob/rel/commons-lang-3.13.0/src/main/java/org/apache/commons/lang3/StringUtils.java#L3596[org.apache.commons.lang3.StringUtils#isEmpty]
29
117
30
118
[source,java]
31
119
....
@@ -52,3 +140,42 @@ public static boolean isEmpty(final CharSequence cs) {
52
140
return cs == null || cs.length() == 0;
53
141
}
54
142
....
143
+
144
+ == 属性
145
+
146
+ === Integer#MAX_VALUE
147
+
148
+ * link:https://github.com/openjdk/jdk/tree/jdk8-b120[openJDK jdk8-b120]
149
+ * link:https://github.com/openjdk/jdk/blob/jdk8-b120/jdk/src/share/classes/java/lang/Integer.java#L63[java.lang.Integer#MAX_VALUE]
150
+
151
+ [source,java]
152
+ ....
153
+ /**
154
+ * A constant holding the maximum value an {@code int} can
155
+ * have, 2<sup>31</sup>-1.
156
+ */
157
+ @Native public static final int MAX_VALUE = 0x7fffffff;
158
+ ....
159
+
160
+
161
+ === StringUtils#SPACE, EMPTY
162
+
163
+ * link:https://github.com/apache/commons-lang/tree/rel/commons-lang-3.13.0[org.apache.commons:commons-lang3:3.13.0]
164
+ * link:https://github.com/apache/commons-lang/blob/rel/commons-lang-3.13.0/src/main/java/org/apache/commons/lang3/StringUtils.java#L148[org.apache.commons.lang3.StringUtils#SPACE, EMPTY]
165
+
166
+
167
+ [source,java]
168
+ ....
169
+ /**
170
+ * A String for a space character.
171
+ *
172
+ * @since 3.2
173
+ */
174
+ public static final String SPACE = " ";
175
+
176
+ /**
177
+ * The empty String {@code ""}.
178
+ * @since 2.0
179
+ */
180
+ public static final String EMPTY = "";
181
+ ....
0 commit comments