Interface StatusMapper

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface StatusMapper
Strategy used to map a health status to a gRPC HealthCheckResponse.ServingStatus.
Since:
4.1.0
Author:
Phillip Webb
  • Method Summary

    Modifier and Type
    Method
    Description
    Return an StatusMapper instance using default mappings.
    io.grpc.health.v1.HealthCheckResponse.ServingStatus
    Return the HTTP status code that corresponds to the given health status.
    of(@Nullable Map<String, io.grpc.health.v1.HealthCheckResponse.ServingStatus> mappings)
    Create a new StatusMapper with the specified mappings.
  • Method Details

    • getServingStatus

      io.grpc.health.v1.HealthCheckResponse.ServingStatus getServingStatus(Status status)
      Return the HTTP status code that corresponds to the given health status.
      Parameters:
      status - the health status to map
      Returns:
      the corresponding HTTP status code
    • of

      static StatusMapper of(@Nullable Map<String, io.grpc.health.v1.HealthCheckResponse.ServingStatus> mappings)
      Create a new StatusMapper with the specified mappings.
      Parameters:
      mappings - the mappings to use or null to use the default mappings
      Returns:
      a StatusMapper or getDefault()
    • getDefault

      static StatusMapper getDefault()
      Return an StatusMapper instance using default mappings.
      Returns:
      a mapper using default mappings