Skip to content

Commit 33b84a7

Browse files
committed
Handle ValueExtractor better in factory classes
(merge main -> ce/main 118390) [git-p4: depot-paths = "//dev/coherence-ce/main/": change = 118391]
1 parent 90c2618 commit 33b84a7

File tree

3 files changed

+56
-56
lines changed

3 files changed

+56
-56
lines changed

prj/coherence-core/src/main/java/com/tangosol/util/Aggregators.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
2+
* Copyright (c) 2000, 2025, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
55
* https://oss.oracle.com/licenses/upl.
@@ -133,7 +133,7 @@ public class Aggregators
133133
public static <K, V, T> InvocableMap.StreamingAggregator<K, V, ?, Double>
134134
average(ValueExtractor<? super T, ? extends Number> extractor)
135135
{
136-
return new DoubleAverage(extractor);
136+
return new DoubleAverage(ValueExtractor.of(extractor));
137137
}
138138

139139
/**
@@ -235,7 +235,7 @@ public class Aggregators
235235
public static <K, V, T> InvocableMap.StreamingAggregator<K, V, ?, Double>
236236
doubleMax(ValueExtractor<? super T, ? extends Number> extractor)
237237
{
238-
return new DoubleMax(extractor);
238+
return new DoubleMax(ValueExtractor.of(extractor));
239239
}
240240

241241
/**
@@ -269,7 +269,7 @@ public class Aggregators
269269
public static <K, V, T> InvocableMap.StreamingAggregator<K, V, ?, Double>
270270
doubleMin(ValueExtractor<? super T, ? extends Number> extractor)
271271
{
272-
return new DoubleMin(extractor);
272+
return new DoubleMin(ValueExtractor.of(extractor));
273273
}
274274

275275
/**
@@ -303,7 +303,7 @@ public class Aggregators
303303
public static <K, V, T> InvocableMap.StreamingAggregator<K, V, ?, Double>
304304
doubleSum(ValueExtractor<? super T, ? extends Number> extractor)
305305
{
306-
return new DoubleSum(extractor);
306+
return new DoubleSum(ValueExtractor.of(extractor));
307307
}
308308

309309
/**
@@ -473,7 +473,7 @@ public class Aggregators
473473
public static <K, V, T> InvocableMap.StreamingAggregator<K, V, ?, Long>
474474
longMax(ValueExtractor<? super T, ? extends Number> extractor)
475475
{
476-
return new LongMax(extractor);
476+
return new LongMax(ValueExtractor.of(extractor));
477477
}
478478

479479
/**
@@ -507,7 +507,7 @@ public class Aggregators
507507
public static <K, V, T> InvocableMap.StreamingAggregator<K, V, ?, Long>
508508
longMin(ValueExtractor<? super T, ? extends Number> extractor)
509509
{
510-
return new LongMin(extractor);
510+
return new LongMin(ValueExtractor.of(extractor));
511511
}
512512

513513
/**
@@ -541,7 +541,7 @@ public class Aggregators
541541
public static <K, V, T> InvocableMap.StreamingAggregator<K, V, ?, Long>
542542
longSum(ValueExtractor<? super T, ? extends Number> extractor)
543543
{
544-
return new LongSum(extractor);
544+
return new LongSum(ValueExtractor.of(extractor));
545545
}
546546

547547
/**
@@ -643,7 +643,7 @@ public class Aggregators
643643
public static <K, V, T> InvocableMap.StreamingAggregator<K, V, ?, BigDecimal>
644644
bigDecimalAverage(ValueExtractor<? super T, ? extends Number> extractor)
645645
{
646-
return new BigDecimalAverage(extractor);
646+
return new BigDecimalAverage(ValueExtractor.of(extractor));
647647
}
648648

649649
/**
@@ -677,7 +677,7 @@ public class Aggregators
677677
public static <K, V, T> InvocableMap.StreamingAggregator<K, V, ?, BigDecimal>
678678
bigDecimalMax(ValueExtractor<? super T, ? extends Number> extractor)
679679
{
680-
return new BigDecimalMax(extractor);
680+
return new BigDecimalMax(ValueExtractor.of(extractor));
681681
}
682682

683683
/**
@@ -711,7 +711,7 @@ public class Aggregators
711711
public static <K, V, T> InvocableMap.StreamingAggregator<K, V, ?, BigDecimal>
712712
bigDecimalMin(ValueExtractor<? super T, ? extends Number> extractor)
713713
{
714-
return new BigDecimalMin(extractor);
714+
return new BigDecimalMin(ValueExtractor.of(extractor));
715715
}
716716

717717
/**
@@ -745,7 +745,7 @@ public class Aggregators
745745
public static <K, V, T> InvocableMap.StreamingAggregator<K, V, ?, BigDecimal>
746746
bigDecimalSum(ValueExtractor<? super T, ? extends Number> extractor)
747747
{
748-
return new BigDecimalSum(extractor);
748+
return new BigDecimalSum(ValueExtractor.of(extractor));
749749
}
750750

751751
/**
@@ -815,7 +815,7 @@ public class Aggregators
815815
public static <K, V, T, R extends Comparable<? super R>> InvocableMap.StreamingAggregator<K, V, ?, R>
816816
comparableMax(ValueExtractor<? super T, ? extends R> extractor)
817817
{
818-
return new ComparableMax(extractor);
818+
return new ComparableMax(ValueExtractor.of(extractor));
819819
}
820820

821821
/**
@@ -834,7 +834,7 @@ public class Aggregators
834834
public static <K, V, T, R extends Comparable<? super R>> InvocableMap.StreamingAggregator<K, V, ?, R>
835835
comparableMax(ValueExtractor<? super T, ? extends R> extractor, Comparator<? super R> comparator)
836836
{
837-
return new ComparableMax(extractor, comparator);
837+
return new ComparableMax(ValueExtractor.of(extractor), comparator);
838838
}
839839

840840
/**
@@ -893,7 +893,7 @@ public class Aggregators
893893
public static <K, V, T, R extends Comparable<? super R>> InvocableMap.StreamingAggregator<K, V, ?, R>
894894
comparableMin(ValueExtractor<? super T, ? extends R> extractor)
895895
{
896-
return new ComparableMin(extractor);
896+
return new ComparableMin(ValueExtractor.of(extractor));
897897
}
898898

899899
/**
@@ -912,7 +912,7 @@ public class Aggregators
912912
public static <K, V, T, R extends Comparable<? super R>> InvocableMap.StreamingAggregator<K, V, ?, R>
913913
comparableMin(ValueExtractor<? super T, ? extends R> extractor, Comparator<? super R> comparator)
914914
{
915-
return new ComparableMin(extractor, comparator);
915+
return new ComparableMin(ValueExtractor.of(extractor), comparator);
916916
}
917917

918918
/**
@@ -989,7 +989,7 @@ public static <K, V> Count<K, V> count()
989989
public static <K, V, T, R> DistinctValues<K, V, T, R>
990990
distinctValues(ValueExtractor<? super T, ? extends R> extractor)
991991
{
992-
return new DistinctValues<>(extractor);
992+
return new DistinctValues<>(ValueExtractor.of(extractor));
993993
}
994994

995995
/**
@@ -1099,7 +1099,7 @@ public static <K, V> Count<K, V> count()
10991099
public static <K, V, T, E, R> GroupAggregator<K, V, T, E, R>
11001100
grouping(ValueExtractor<? super T, ? extends E> extractor, InvocableMap.EntryAggregator<K, V, R> aggregator)
11011101
{
1102-
return grouping(extractor, aggregator, null);
1102+
return grouping(ValueExtractor.of(extractor), aggregator, null);
11031103
}
11041104

11051105
/**
@@ -1119,11 +1119,11 @@ public static <K, V> Count<K, V> count()
11191119
* @param <R> the type of the group aggregator result
11201120
*/
11211121
public static <K, V, T, E, R> GroupAggregator<K, V, T, E, R>
1122-
grouping(ValueExtractor<? super T, ? extends E> extractor,
1122+
grouping(ValueExtractor<? super T, ? extends E> extractor,
11231123
InvocableMap.EntryAggregator<? super K, ? super V, R> aggregator,
11241124
Filter filter)
11251125
{
1126-
return GroupAggregator.createInstance(extractor, aggregator, filter);
1126+
return GroupAggregator.createInstance(ValueExtractor.of(extractor), aggregator, filter);
11271127
}
11281128

11291129
/**
@@ -1144,7 +1144,7 @@ public static <K, V> Count<K, V> count()
11441144
public static <K, V, T, R extends Comparable<? super R>> TopNAggregator<K, V, T, R>
11451145
topN(ValueExtractor<? super T, ? extends R> extractor, int cResults)
11461146
{
1147-
return new TopNAggregator<>(extractor, null, cResults);
1147+
return new TopNAggregator<>(ValueExtractor.of(extractor), null, cResults);
11481148
}
11491149

11501150
/**
@@ -1164,7 +1164,7 @@ public static <K, V> Count<K, V> count()
11641164
public static <K, V, T, R> TopNAggregator<K, V, T, R>
11651165
topN(ValueExtractor<? super T, ? extends R> extractor, Comparator<? super R> comparator, int cResults)
11661166
{
1167-
return new TopNAggregator<>(extractor, comparator, cResults);
1167+
return new TopNAggregator<>(ValueExtractor.of(extractor), comparator, cResults);
11681168
}
11691169

11701170
/**
@@ -1221,7 +1221,7 @@ public static <K, V> Count<K, V> count()
12211221
public static <K, V, T, R extends Comparable<? super R>> ReducerAggregator<K, V, T, R>
12221222
reduce(ValueExtractor<? super T, ? extends R> extractor)
12231223
{
1224-
return new ReducerAggregator(extractor);
1224+
return new ReducerAggregator(ValueExtractor.of(extractor));
12251225
}
12261226

12271227
/**
@@ -1327,6 +1327,6 @@ public static <K, V, P, R> ScriptAggregator<K, V, P, R> script(
13271327
*/
13281328
public static <K, V, T> SimilaritySearch<K, V, T> similaritySearch(ValueExtractor<? super V, ? extends Vector<T>> extractor, Vector<T> vector, int maxResults)
13291329
{
1330-
return new SimilaritySearch<>(extractor, vector, maxResults);
1330+
return new SimilaritySearch<>(ValueExtractor.of(extractor), vector, maxResults);
13311331
}
13321332
}

0 commit comments

Comments
 (0)