Skip to content

Commit

Permalink
Change method signature to allow i.e. List<Row<Number>> as a parameter (
Browse files Browse the repository at this point in the history
#5391)

This should be backward compatible since it is expanding the accepted parameter type.

fixes #5390

Co-authored-by: Lars Bilger <lars.bilger@lht.dlh.de>
  • Loading branch information
lbilger and Lars Bilger authored Aug 28, 2024
1 parent 600e8d4 commit 5cf7222
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,26 @@ public static Builder builder(String name) {
return new Builder(name);
}

public void register(Iterable<Row<?>> rows) {
public void register(Iterable<? extends Row<?>> rows) {
register(rows, false);
}

@SuppressWarnings("unchecked")
public void register(Iterable<Row<?>> rows, boolean overwrite) {
public void register(Iterable<? extends Row<?>> rows, boolean overwrite) {
registeredRows.getAndUpdate(oldRows -> {
// for some reason the compiler needs type assistance by creating this
// intermediate variable.
Stream<Meter.Id> idStream = StreamSupport.stream(rows.spliterator(), false).map(row -> {
Row r = row;
Meter.Id rowId = commonId.withTags(row.uniqueTags);
Meter.Id rowId = commonId.withTags(r.uniqueTags);
boolean previouslyDefined = oldRows.contains(rowId);

if (overwrite && previouslyDefined) {
registry.removeByPreFilterId(rowId);
}

if (overwrite || !previouslyDefined) {
registry.gauge(rowId, row.obj, new StrongReferenceGaugeFunction<>(r.obj, r.valueFunction));
registry.gauge(rowId, r.obj, new StrongReferenceGaugeFunction<>(r.obj, r.valueFunction));
}

return rowId;
Expand Down

0 comments on commit 5cf7222

Please sign in to comment.