Skip to content

Instantly share code, notes, and snippets.

@arhimondr
Created August 30, 2019 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arhimondr/6563d1dcd0ad084c25ebd67c3774be89 to your computer and use it in GitHub Desktop.
Save arhimondr/6563d1dcd0ad084c25ebd67c3774be89 to your computer and use it in GitHub Desktop.
public static class Parts
{
private final Optional<StatisticAggregations> finalAggregation;
private final Optional<StatisticAggregations> intermediateAggregation;
private final StatisticAggregations partialAggregation;
public Parts(
Optional<StatisticAggregations> finalAggregation,
Optional<StatisticAggregations> intermediateAggregation,
StatisticAggregations partialAggregation)
{
this.finalAggregation = requireNonNull(finalAggregation, "finalAggregation is null");
this.intermediateAggregation = requireNonNull(intermediateAggregation, "intermediateAggregation is null");
this.partialAggregation = requireNonNull(partialAggregation, "partialAggregation is null");
}
public StatisticAggregations getFinalAggregation()
{
return finalAggregation.orElseThrow(() -> new IllegalStateException("finalAggregation is not present"));
}
public StatisticAggregations getIntermediateAggregation()
{
return intermediateAggregation.orElseThrow(() -> new IllegalStateException("intermediateAggregation is not present"));
}
public StatisticAggregations getPartialAggregation()
{
return partialAggregation;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment