Skip to content

Commit 719e3e6

Browse files
authored
Merge pull request #19934 from Channyboy/17656-trdoc
Clarify usage of the Tr API
2 parents 231e3f1 + 6a122a5 commit 719e3e6

File tree

1 file changed

+105
-1
lines changed
  • dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras

1 file changed

+105
-1
lines changed

dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/Tr.java

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2010, 2014 IBM Corporation and others.
2+
* Copyright (c) 2010, 2022 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -150,6 +150,19 @@ public class Tr {
150150
* annotation can be specified at the class and/or the package level; the
151151
* class-level annotation will be given priority. If both traceGroup and
152152
* traceGroups are specified, traceGroups will be given priority.
153+
* </br>
154+
* </br>
155+
* This method should be used <b>statically as a private final global element in the target class</b>
156+
* </br>
157+
* For example:
158+
* </br>
159+
* <code>public class Example {
160+
* </br>
161+
* private final static TraceComponent tc = Tr.register( ... );
162+
* </br>
163+
* ...
164+
* </br>
165+
* }</code>
153166
*
154167
* @param aClass
155168
* a valid <code>Class</code> to register a component for with
@@ -195,6 +208,19 @@ public static TraceComponent register(Class<?> aClass) {
195208
/**
196209
* Register the provided name with the trace service and assign it to the
197210
* provided group name.
211+
* </br>
212+
* </br>
213+
* This method should be used <b>statically as a private final global element in the target class</b>
214+
* </br>
215+
* For example:
216+
* </br>
217+
* <code>public class Example {
218+
* </br>
219+
* private final static TraceComponent tc = Tr.register( ... );
220+
* </br>
221+
* ...
222+
* </br>
223+
* }</code>
198224
*
199225
* @param name
200226
* a <code>String</code> to register a component for with
@@ -219,6 +245,19 @@ public static TraceComponent register(String name, Class<?> aClass, String group
219245
/**
220246
* Register the provided name with the trace service and assign it to the
221247
* provided groups.
248+
* </br>
249+
* </br>
250+
* This method should be used <b>statically as a private final global element in the target class</b>
251+
* </br>
252+
* For example:
253+
* </br>
254+
* <code>public class Example {
255+
* </br>
256+
* private final static TraceComponent tc = Tr.register( ... );
257+
* </br>
258+
* ...
259+
* </br>
260+
* }</code>
222261
*
223262
* @param name
224263
* a <code>String</code> to register a component for with
@@ -243,6 +282,19 @@ public static TraceComponent register(String name, Class<?> aClass, String[] gro
243282
/**
244283
* Register the provided class with the trace service and assign it to the
245284
* provided group name.
285+
* </br>
286+
* </br>
287+
* This method should be used <b>statically as a private final global element in the target class</b>
288+
* </br>
289+
* For example:
290+
* </br>
291+
* <code>public class Example {
292+
* </br>
293+
* private final static TraceComponent tc = Tr.register( ... );
294+
* </br>
295+
* ...
296+
* </br>
297+
* }</code>
246298
*
247299
* @param aClass
248300
* a valid <code>Class</code> to register a component for with
@@ -264,6 +316,19 @@ public static TraceComponent register(Class<?> aClass, String group) {
264316
* Register the provided class with the trace service and assign it to the
265317
* provided group name. Translated messages will attempt to use the input
266318
* message bundle source.
319+
* </br>
320+
* </br>
321+
* This method should be used <b>statically as a private final global element in the target class</b>
322+
* </br>
323+
* For example:
324+
* </br>
325+
* <code>public class Example {
326+
* </br>
327+
* private final static TraceComponent tc = Tr.register( ... );
328+
* </br>
329+
* ...
330+
* </br>
331+
* }</code>
267332
*
268333
* @param aClass
269334
* a valid <code>Class</code> to register a component for with
@@ -293,6 +358,19 @@ public static TraceComponent register(Class<?> aClass, String group, String bund
293358
* Register the provided class with the trace service and assign it to the
294359
* provided group name. Translated messages will attempt to use the input
295360
* message bundle source.
361+
* </br>
362+
* </br>
363+
* This method should be used <b>statically as a private final global element in the target class</b>
364+
* </br>
365+
* For example:
366+
* </br>
367+
* <code>public class Example {
368+
* </br>
369+
* private final static TraceComponent tc = Tr.register( ... );
370+
* </br>
371+
* ...
372+
* </br>
373+
* }</code>
296374
*
297375
* @param aClass
298376
* a valid <code>Class</code> to register a component for with
@@ -322,6 +400,19 @@ public static TraceComponent register(Class<?> aClass, String[] groups, String b
322400
* Register the provided name with the trace service and assign it to the
323401
* provided group name. Translated messages will attempt to use the input
324402
* message bundle source.
403+
* </br>
404+
* </br>
405+
* This method should be used <b>statically as a private final global element in the target class</b>
406+
* </br>
407+
* For example:
408+
* </br>
409+
* <code>public class Example {
410+
* </br>
411+
* private final static TraceComponent tc = Tr.register( ... );
412+
* </br>
413+
* ...
414+
* </br>
415+
* }</code>
325416
*
326417
* @param name
327418
* a <code>String</code> to register a component for with
@@ -355,6 +446,19 @@ public static TraceComponent register(String name, Class<?> aClass, String group
355446
* Register the provided name with the trace service and assign it to the
356447
* provided groups. Translated messages will attempt to use the input
357448
* message bundle source.
449+
* </br>
450+
* </br>
451+
* This method should be used <b>statically as a private final global element in the target class</b>
452+
* </br>
453+
* For example:
454+
* </br>
455+
* <code>public class Example {
456+
* </br>
457+
* private final static TraceComponent tc = Tr.register( ... );
458+
* </br>
459+
* ...
460+
* </br>
461+
* }</code>
358462
*
359463
* @param name
360464
* a <code>String</code> to register a component for with

0 commit comments

Comments
 (0)