mirror of https://github.com/grpc/grpc-java.git
grpc-context: name Context#key(name) parameter more clearly
Motivated by #7024
This commit is contained in:
parent
cc2d376a93
commit
6b9cd6d6ed
|
|
@ -153,19 +153,25 @@ public class Context {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a {@link Key} with the given debug name. Multiple different keys may have the same name;
|
||||
* the name is intended for debugging purposes and does not impact behavior.
|
||||
* Create a {@link Key} with the given debug name.
|
||||
*
|
||||
* @param debugString a name intended for debugging purposes and does not impact behavior.
|
||||
* Multiple different keys may have the same debugString.
|
||||
* The value should be not null.
|
||||
*/
|
||||
public static <T> Key<T> key(String name) {
|
||||
return new Key<>(name);
|
||||
public static <T> Key<T> key(String debugString) {
|
||||
return new Key<>(debugString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@link Key} with the given debug name and default value. Multiple different keys may
|
||||
* have the same name; the name is intended for debugging purposes and does not impact behavior.
|
||||
* Create a {@link Key} with the given debug name and default value.
|
||||
*
|
||||
* @param debugString a name intended for debugging purposes and does not impact behavior.
|
||||
* Multiple different keys may have the same debugString.
|
||||
* The value should be not null.
|
||||
*/
|
||||
public static <T> Key<T> keyWithDefault(String name, T defaultValue) {
|
||||
return new Key<>(name, defaultValue);
|
||||
public static <T> Key<T> keyWithDefault(String debugString, T defaultValue) {
|
||||
return new Key<>(debugString, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue