Package io.grpc

Class CallOptions.Key<T>

  • Enclosing class:
    CallOptions

    public static final class CallOptions.Key<T>
    extends java.lang.Object
    Key for a key-value pair. Uses reference equality.
    • Method Detail

      • getDefault

        public T getDefault()
        Returns the user supplied default value for this key.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • of

        @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1869")
        @Deprecated
        public static <T> CallOptions.Key<T> of​(java.lang.String debugString,
                                                T defaultValue)
        Deprecated.
        Use create(java.lang.String) or createWithDefault(java.lang.String, T) instead. This method will be removed.
        Factory method for creating instances of CallOptions.Key.
        Type Parameters:
        T - Key type
        Parameters:
        debugString - a string used to describe this key, used for debugging.
        defaultValue - default value to return when value for key not set
        Returns:
        Key object
      • create

        public static <T> CallOptions.Key<T> create​(java.lang.String debugString)
        Factory method for creating instances of CallOptions.Key. The default value of the key is null.
        Type Parameters:
        T - Key type
        Parameters:
        debugString - a debug string that describes this key.
        Returns:
        Key object
        Since:
        1.13.0
      • createWithDefault

        public static <T> CallOptions.Key<T> createWithDefault​(java.lang.String debugString,
                                                               T defaultValue)
        Factory method for creating instances of CallOptions.Key.
        Type Parameters:
        T - Key type
        Parameters:
        debugString - a debug string that describes this key.
        defaultValue - default value to return when value for key not set
        Returns:
        Key object
        Since:
        1.13.0