Skip to content

Commit f93396d

Browse files
committed
javadoc
1 parent 9e9e156 commit f93396d

3 files changed

Lines changed: 20 additions & 6 deletions

File tree

components/context/src/main/java/datadog/context/Context.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,20 @@
55

66
import javax.annotation.Nullable;
77

8-
/** Immutable context scoped to an execution unit or carrier object. */
8+
/**
9+
* Immutable context scoped to an execution unit or carrier object.
10+
*
11+
* <p>Each element of the context is accessible by its {@link ContextKey}. Keys represents product
12+
* or functional areas and should be created sparingly. Elements in the context may themselves be
13+
* mutable.
14+
*/
915
public interface Context {
1016

11-
/** Returns the root context. */
17+
/**
18+
* Returns the root context.
19+
*
20+
* <p>This is the initial local context that all contexts extend.
21+
*/
1222
static Context root() {
1323
return manager().root();
1424
}
@@ -72,14 +82,14 @@ static Context detachFrom(Object carrier) {
7282
<T> T get(ContextKey<T> key);
7383

7484
/**
75-
* Creates a new context with the given key-value mapping.
85+
* Creates a new context from the same elements, except the key is now mapped to the given value.
7686
*
7787
* @return New context with the key-value mapping.
7888
*/
7989
<T> Context with(ContextKey<T> key, T value);
8090

8191
/**
82-
* Creates a new context with a value that has its own implicit key.
92+
* Creates a new context from the same elements, except the implicit key is mapped to this value.
8393
*
8494
* @return New context with the implicitly keyed value.
8595
*/

components/context/src/main/java/datadog/context/ContextKey.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import java.util.concurrent.atomic.AtomicInteger;
44

55
/**
6-
* Key for indexing values of type {@link T} stored in a {@link Context}.
6+
* {@link Context} key that maps to a value of type {@link T}.
77
*
88
* <p>Keys are compared by identity rather than by name. Each stored context type should either
99
* share its key for re-use or implement {@link ImplicitContextKeyed} to keep its key private.

components/context/src/main/java/datadog/context/ContextManager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
/** Manages context across execution units. */
44
public interface ContextManager {
55

6-
/** Returns the root context. */
6+
/**
7+
* Returns the root context.
8+
*
9+
* <p>This is the initial local context that all contexts extend.
10+
*/
711
Context root();
812

913
/**

0 commit comments

Comments
 (0)