Skip to content

Commit 66b0a6c

Browse files
committed
improve code samples in javadoc
Signed-off-by: Lukas Jungmann <[email protected]>
1 parent 2ef3318 commit 66b0a6c

File tree

3 files changed

+53
-54
lines changed

3 files changed

+53
-54
lines changed

Diff for: api/src/main/java/jakarta/annotation/PostConstruct.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@
3030
* not request any resources to be injected. Only one
3131
* method in a given class can be annotated with this annotation.
3232
* The method on which the {@code PostConstruct} annotation is
33-
* applied must fulfill all of the following criteria:
33+
* applied must fulfill all the following criteria:
3434
* <ul>
3535
* <li>The method must not have any parameters except in the case of
3636
* interceptors in which case it takes an {@code InvocationContext}
3737
* object as defined by the Jakarta Interceptors specification.</li>
3838
* <li>The method defined on an interceptor class or superclass of an
3939
* interceptor class must have one of the following signatures:
4040
* <p>
41-
* void &#060;METHOD&#062;(InvocationContext)
41+
* {@code void <METHOD>(InvocationContext)}
4242
* <p>
43-
* Object &#060;METHOD&#062;(InvocationContext) throws Exception
43+
* {@code Object <METHOD>(InvocationContext) throws Exception}
4444
* <p>
4545
* <i>Note: A PostConstruct interceptor method must not throw application
4646
* exceptions, but it may be declared to throw checked exceptions including
@@ -52,7 +52,7 @@
5252
* <li>The method defined on a non-interceptor class must have the
5353
* following signature:
5454
* <p>
55-
* void &#060;METHOD&#062;()
55+
* {@code void <METHOD>()}
5656
* </li>
5757
* <li>The method on which the {@code PostConstruct} annotation
5858
* is applied may be public, protected, package private or private.</li>

Diff for: api/src/main/java/jakarta/annotation/PreDestroy.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
* <li>The method defined on an interceptor class or superclass of an
3838
* interceptor class must have one of the following signatures:
3939
* <p>
40-
* void &#060;METHOD&#062;(InvocationContext)
40+
* {@code void <METHOD>(InvocationContext)}
4141
* <p>
42-
* Object &#060;METHOD&#062;(InvocationContext) throws Exception
42+
* {@code Object <METHOD>(InvocationContext) throws Exception}
4343
* <p>
4444
* <i>Note: A PreDestroy interceptor method must not throw application
4545
* exceptions, but it may be declared to throw checked exceptions including
@@ -51,7 +51,7 @@
5151
* <li>The method defined on a non-interceptor class must have the
5252
* following signature:
5353
* <p>
54-
* void &#060;METHOD&#062;()
54+
* {@code void <METHOD>()}
5555
* </li>
5656
* <li>The method on which PreDestroy is applied may be public, protected,
5757
* package private or private.</li>

Diff for: api/src/main/java/jakarta/annotation/sql/DataSourceDefinition.java

+46-47
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@
4646
* the properties annotation element, the precedence order is undefined
4747
* and implementation specific:
4848
* <p>
49-
* <pre>
50-
* &#064;DataSourceDefinition(name="java:global/MyApp/MyDataSource",
51-
* className="org.apache.derby.jdbc.ClientDataSource",
52-
* url="jdbc:derby://localhost:1527/myDB;user=bill",
53-
* user="lance",
54-
* password="secret",
55-
* databaseName="testDB",
56-
* serverName="luckydog"
57-
* )// DO NOT DO THIS!!!
58-
* </pre>
49+
* {@snippet :
50+
* @DataSourceDefinition(name="java:global/MyApp/MyDataSource",
51+
* className="org.apache.derby.jdbc.ClientDataSource",
52+
* url="jdbc:derby://localhost:1527/myDB;user=bill",
53+
* user="lance",
54+
* password="secret",
55+
* databaseName="testDB",
56+
* serverName="luckydog"
57+
* )// DO NOT DO THIS!!!
58+
* }
5959
* <p>
6060
* In the above example, the {@code databaseName}, {@code user}
6161
* and {@code serverName} properties were specified as part of the
@@ -67,16 +67,16 @@
6767
* annotation element, the annotation element value takes precedence.
6868
* For example:
6969
* <p>
70-
* <pre>
71-
* &#064;DataSourceDefinition(name="java:global/MyApp/MyDataSource",
72-
* className="org.apache.derby.jdbc.ClientDataSource",
73-
* user="lance",
74-
* password="secret",
75-
* databaseName="testDB",
76-
* serverName="luckydog",
77-
* properties= {"databaseName=myDB", "databaseProp=doThis"}
70+
* {@snippet :
71+
* @DataSourceDefinition(name="java:global/MyApp/MyDataSource",
72+
* className="org.apache.derby.jdbc.ClientDataSource",
73+
* user="lance",
74+
* password="secret",
75+
* databaseName="testDB",
76+
* serverName="luckydog",
77+
* properties= {"databaseName=myDB", "databaseProp=doThis"}
7878
* )// DO NOT DO THIS!!!
79-
* </pre>
79+
* }
8080
* <p>
8181
* This would result in the following values being used when configuring
8282
* the DataSource:
@@ -104,38 +104,37 @@
104104
* <p>
105105
* Examples:
106106
* <br>
107-
* <pre>
108-
* &#064;DataSourceDefinition(name="java:global/MyApp/MyDataSource",
109-
* className="com.foobar.MyDataSource",
110-
* portNumber=6689,
111-
* serverName="myserver.com",
112-
* user="lance",
113-
* password="secret"
114-
* )
115-
*
116-
* </pre>
107+
* {@snippet :
108+
* @DataSourceDefinition(name="java:global/MyApp/MyDataSource",
109+
* className="com.foobar.MyDataSource",
110+
* portNumber=6689,
111+
* serverName="myserver.com",
112+
* user="lance",
113+
* password="secret"
114+
* )
115+
* }
117116
* <p>
118117
* Using a {@code URL}:
119118
* <br>
120-
* <pre>
121-
* &#064;DataSourceDefinition(name="java:global/MyApp/MyDataSource",
122-
* className="org.apache.derby.jdbc.ClientDataSource",
123-
* url="jdbc:derby://localhost:1527/myDB",
124-
* user="lance",
125-
* password="secret"
119+
* {@snippet :
120+
* @DataSourceDefinition(name="java:global/MyApp/MyDataSource",
121+
* className="org.apache.derby.jdbc.ClientDataSource",
122+
* url="jdbc:derby://localhost:1527/myDB",
123+
* user="lance",
124+
* password="secret"
126125
* )
127-
* </pre>
126+
* }
128127
* <p>
129128
* An example lookup of the DataSource from an Jakarta Enterprise Beans:
130-
* <pre>
131-
* &#064;Stateless
129+
* {@snippet :
130+
* @Stateless
132131
* public class MyStatelessEJB {
133-
* &#064;Resource(lookup="java:global/MyApp/myDataSource")
134-
* DataSource myDB;
135-
* ...
132+
* @Resource(lookup="java:global/MyApp/myDataSource")
133+
* DataSource myDB;
134+
* ...
136135
* }
137-
* </pre>
138-
* <p>
136+
* }
137+
*
139138
* @see javax.sql.DataSource
140139
* @see javax.sql.XADataSource
141140
* @see javax.sql.ConnectionPoolDataSource
@@ -208,15 +207,15 @@
208207
/**
209208
* Isolation level for connections. The Isolation level
210209
* must be one of the following:
211-
* <p>
210+
*
212211
* <ul>
213212
* <li>Connection.TRANSACTION_NONE,
214213
* <li>Connection.TRANSACTION_READ_ UNCOMMITTED,
215214
* <li>Connection.TRANSACTION_READ_COMMITTED,
216215
* <li>Connection.TRANSACTION_REPEATABLE_READ,
217216
* <li>Connection.TRANSACTION_SERIALIZABLE
218217
*</ul>
219-
* <p>
218+
*
220219
* Default is vendor-specific.
221220
* @since 1.1
222221
*/
@@ -281,14 +280,14 @@
281280
/**
282281
* Used to specify vendor-specific properties and less commonly
283282
* used {@code DataSource} properties such as:
284-
* <p>
283+
*
285284
* <ul>
286285
* <li>dataSourceName
287286
* <li>networkProtocol
288287
* <li>propertyCycle
289288
* <li>roleName
290289
* </ul>
291-
* <p>
290+
*
292291
* Properties are specified using the format:
293292
* <i>propertyName=propertyValue</i> with one property per array element.
294293
* <p>

0 commit comments

Comments
 (0)