All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.paganini2008.devtools.beans.streaming.Summary Maven / Gradle / Ivy

package com.github.paganini2008.devtools.beans.streaming;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * 
 * Summary
 * 
 * @author Fred Feng
 * 
 * 
 * @version 1.0
 */
public interface Summary {

	 T summarize(Calculation calculation);

	default > T min(String attributeName, Class requiredType) {
		return summarize(Functions.min(attributeName, requiredType));
	}

	default > T max(String attributeName, Class requiredType) {
		return summarize(Functions.max(attributeName, requiredType));
	}

	default BigDecimal sum(String attributeName) {
		return summarize(Functions.sum(attributeName));
	}

	default BigDecimal avg(String attributeName) {
		return avg(attributeName, 2, RoundingMode.HALF_UP);
	}

	default BigDecimal avg(String attributeName, int scale, RoundingMode roundingMode) {
		return summarize(Functions.avg(attributeName, scale, roundingMode));
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy