Record Class GrpcServiceInfo

java.lang.Object
java.lang.Record
org.springframework.grpc.server.service.GrpcServiceInfo
Record Components:
interceptors - list of ServerInterceptor bean types to be applied to the service
interceptorNames - list of ServerInterceptor bean names to be applied to the service
blendWithGlobalInterceptors - whether the service specific interceptors should be merged and sorted (blended) with the global interceptors

public record GrpcServiceInfo(Class<? extends io.grpc.ServerInterceptor>[] interceptors, String[] interceptorNames, boolean blendWithGlobalInterceptors) extends Record
Additional information about a gRPC service that can be used when configuring the service.
Author:
Chris Bono
  • Constructor Details

    • GrpcServiceInfo

      public GrpcServiceInfo(Class<? extends io.grpc.ServerInterceptor>[] interceptors, String[] interceptorNames, boolean blendWithGlobalInterceptors)
      Creates an instance of a GrpcServiceInfo record class.
      Parameters:
      interceptors - the value for the interceptors record component
      interceptorNames - the value for the interceptorNames record component
      blendWithGlobalInterceptors - the value for the blendWithGlobalInterceptors record component
  • Method Details

    • from

      public static @Nullable GrpcServiceInfo from(@Nullable GrpcService grpcService)
      Construct a service info from a GrpcService annotation.
      Parameters:
      grpcService - the service annotation
      Returns:
      the service info or null if the supplied annotation is null
    • withInterceptors

      public static GrpcServiceInfo withInterceptors(List<Class<? extends io.grpc.ServerInterceptor>> interceptors)
      Construct a service info with the specified interceptors.
      Parameters:
      interceptors - non-null list of interceptor bean types
      Returns:
      the service info with the supplied interceptors
    • withInterceptorNames

      public static GrpcServiceInfo withInterceptorNames(List<String> interceptorNames)
      Construct a service info with the specified interceptors names.
      Parameters:
      interceptorNames - non-null list of interceptor bean names
      Returns:
      the service info with the supplied interceptors names
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • interceptors

      public Class<? extends io.grpc.ServerInterceptor>[] interceptors()
      Returns the value of the interceptors record component.
      Returns:
      the value of the interceptors record component
    • interceptorNames

      public String[] interceptorNames()
      Returns the value of the interceptorNames record component.
      Returns:
      the value of the interceptorNames record component
    • blendWithGlobalInterceptors

      public boolean blendWithGlobalInterceptors()
      Returns the value of the blendWithGlobalInterceptors record component.
      Returns:
      the value of the blendWithGlobalInterceptors record component