INNER CODE UNIT · Java

isReturnTypeServiceMessage

scalecube/scalecube-services · services-api/src/main/java/io/scalecube/services/Reflect.java:74

  public static boolean isReturnTypeServiceMessage(Method method) {
    Type type = method.getGenericReturnType();

    if (type instanceof ParameterizedType) {
      Type actualReturnType = ((ParameterizedType) type).getActualTypeArguments()[0];

      return ServiceMessage.class.equals(actualReturnType);
    }

    return false;
  }

  /**
   * Returns the the type of method parameter. In case the method is annotated with {@link
   * RequestType} this type will always be chosen. If the parameter is generic, eg. {@link String},
   * then actual type will be used. In case there is no annotation and the type is not generic then
   * return the actual type. In case method accepts service message and no RequestType annotation is
   * present then return Object.class

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…