grpc-context: name Context#key(name) parameter more clearly

Motivated by #7024
This commit is contained in:
Jongho Jeon 2020-05-14 05:35:17 +09:00 committed by GitHub
parent cc2d376a93
commit 6b9cd6d6ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 8 deletions

View File

@ -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);
}
/**