2626 * aggregating the {@link Status} instances and not deal with contextual details etc.
2727 *
2828 * @author Christian Dupuis
29+ * @author Vedran Pavic
2930 * @since 1.1.0
3031 */
3132public abstract class AbstractHealthAggregator implements HealthAggregator {
3233
3334 @ Override
3435 public final Health aggregate (Map <String , Health > healths ) {
3536 List <Status > statusCandidates = new ArrayList <Status >();
36- Map <String , Object > details = new LinkedHashMap <String , Object >();
3737 for (Map .Entry <String , Health > entry : healths .entrySet ()) {
38- details .put (entry .getKey (), entry .getValue ());
3938 statusCandidates .add (entry .getValue ().getStatus ());
4039 }
41- return new Health .Builder (aggregateStatus (statusCandidates ), details ).build ();
40+ Status status = aggregateStatus (statusCandidates );
41+ Map <String , Object > details = aggregateDetails (healths );
42+ return new Health .Builder (status , details ).build ();
4243 }
4344
4445 /**
@@ -49,4 +50,15 @@ public final Health aggregate(Map<String, Health> healths) {
4950 */
5051 protected abstract Status aggregateStatus (List <Status > candidates );
5152
53+ /**
54+ * Return the map of 'aggregate' details that should be used from the specified
55+ * healths.
56+ * @param healths the health instances to aggregate
57+ * @return a map of details
58+ * @since 1.3.1
59+ */
60+ protected Map <String , Object > aggregateDetails (Map <String , Health > healths ) {
61+ return new LinkedHashMap <String , Object >(healths );
62+ }
63+
5264}
0 commit comments