- java.lang.Object
-
- io.helidon.grpc.core.GrpcHelper
-
public final class GrpcHelper extends Object
Helper methods for common gRPC tasks.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ThrowableensureStatusException(Throwable thrown, io.grpc.Status status)static io.grpc.StatusRuntimeExceptionensureStatusRuntimeException(Throwable thrown, io.grpc.Status status)Ensure that aThrowableis aStatusRuntimeException.static StringextractMethodName(String fullMethodName)Extract the gRPC method name from a method full name.static StringextractNamePrefix(String fullMethodName)Extract the name prefix from from a method full name.static StringextractServiceName(String fullMethodName)Extract the gRPC service name from a method full name.static Http.ResponseStatustoHttpResponseStatus(io.grpc.Status status)Convert a gRPCStatusto aHttp.ResponseStatus.static Http.ResponseStatustoHttpResponseStatus(io.grpc.StatusException ex)Convert a gRPCStatusExceptionto aHttp.ResponseStatus.static Http.ResponseStatustoHttpResponseStatus(io.grpc.StatusRuntimeException ex)Convert a gRPCStatusRuntimeExceptionto aHttp.ResponseStatus.
-
-
-
Method Detail
-
extractServiceName
public static String extractServiceName(String fullMethodName)
Extract the gRPC service name from a method full name.- Parameters:
fullMethodName- the gRPC method full name- Returns:
- the service name extracted from the full name
-
extractNamePrefix
public static String extractNamePrefix(String fullMethodName)
Extract the name prefix from from a method full name.The prefix is everything upto the but not including the last '/' character in the full name.
- Parameters:
fullMethodName- the gRPC method full name- Returns:
- the name prefix extracted from the full name
-
extractMethodName
public static String extractMethodName(String fullMethodName)
Extract the gRPC method name from a method full name.- Parameters:
fullMethodName- the gRPC method full name- Returns:
- the method name extracted from the full name
-
toHttpResponseStatus
public static Http.ResponseStatus toHttpResponseStatus(io.grpc.StatusException ex)
Convert a gRPCStatusExceptionto aHttp.ResponseStatus.- Parameters:
ex- the gRPCStatusExceptionto convert- Returns:
- the gRPC
StatusExceptionconverted to aHttp.ResponseStatus
-
toHttpResponseStatus
public static Http.ResponseStatus toHttpResponseStatus(io.grpc.StatusRuntimeException ex)
Convert a gRPCStatusRuntimeExceptionto aHttp.ResponseStatus.- Parameters:
ex- the gRPCStatusRuntimeExceptionto convert- Returns:
- the gRPC
StatusRuntimeExceptionconverted to aHttp.ResponseStatus
-
toHttpResponseStatus
public static Http.ResponseStatus toHttpResponseStatus(io.grpc.Status status)
Convert a gRPCStatusto aHttp.ResponseStatus.- Parameters:
status- the gRPCStatusto convert- Returns:
- the gRPC
Statusconverted to aHttp.ResponseStatus
-
ensureStatusException
public static Throwable ensureStatusException(Throwable thrown, io.grpc.Status status)
-
-