br.com.anteros.bean.validation.constraints.validators.TimeAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Anteros-Bean-Validation Show documentation
Show all versions of Anteros-Bean-Validation Show documentation
Anteros Bean Validation for Java.
package br.com.anteros.bean.validation.constraints.validators;
import java.util.function.Function;
import java.util.function.Supplier;
public class TimeAction {
public static TimeActionResponse recordTimeAndDo(Function function, Input val) {
long t1 = System.currentTimeMillis();
Ret result = function.apply(val);
long t2 = System.currentTimeMillis() - t1;
return new TimeActionResponse<>(result, t2);
}
public static TimeActionResponse recordTimeAndDo(Supplier supplier) {
long t1 =System.currentTimeMillis();
Ret result = supplier.get();
long t2 = System.currentTimeMillis() - t1;
return new TimeActionResponse<>(result, t2);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy