You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have generated a JHipster project with entities and then ran the gRPC generator. I inspected what was generated and discovered that at least one generated class does not match up with the template I assume it is based on.
For example, the MetricsService class (<package>.grpc.MetricsService.java):
package <mypackagenameremoved>.grpc;
importcom.google.protobuf.Empty;
importorg.lognet.springboot.grpc.GRpcService;
importorg.springframework.boot.actuate.endpoint.PublicMetrics;
importorg.springframework.core.annotation.AnnotationAwareOrderComparator;
importorg.springframework.util.Assert;
importreactor.core.publisher.Flux;
importreactor.core.publisher.Mono;
importjava.util.ArrayList;
importjava.util.Collection;
importjava.util.List;
@GRpcService(interceptors = {AuthenticationInterceptor.class})
publicclassMetricServiceextendsReactorMetricServiceGrpc.MetricServiceImplBase {
privatefinalList<PublicMetrics> publicMetrics;
/** * Create a new {@link MetricService} instance. * @param publicMetrics the metrics to expose. The collection will be sorted using the * {@link AnnotationAwareOrderComparator}. */publicMetricService(Collection<PublicMetrics> publicMetrics) {
Assert.notNull(publicMetrics, "PublicMetrics must not be null");
this.publicMetrics = newArrayList<>(publicMetrics);
AnnotationAwareOrderComparator.sort(this.publicMetrics);
}
@OverridepublicFlux<Metric> getMetrics(Mono<Empty> request) {
returnrequest
.flatMapIterable(empty -> publicMetrics)
.flatMapIterable(PublicMetrics::metrics)
.map(metric -> {
Metric.Builderbuilder = Metric.newBuilder()
.setName(metric.getName());
if (metric.getTimestamp() != null) {
builder.setTimestamp(ProtobufMappers.dateToTimestamp(metric.getTimestamp()));
}
if (metric.getValue() instanceofLong || metric.getValue() instanceofInteger) {
builder.setLongValue(metric.getValue().longValue());
} elseif (metric.getValue() instanceofFloat || metric.getValue() instanceofDouble) {
builder.setDoubleValue((metric.getValue()).doubleValue());
} else {
builder.setStringValue(metric.getValue().toString());
}
returnbuilder.build();
});
}
}
I have generated a JHipster project with entities and then ran the gRPC generator. I inspected what was generated and discovered that at least one generated class does not match up with the template I assume it is based on.
For example, the MetricsService class (
<package>.grpc.MetricsService.java
):While the template (
_MetricService.java
):Wouldn't the generated class be a replication of the template?
The text was updated successfully, but these errors were encountered: