org.rx.bean.ProceedEventArgs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rxlib Show documentation
Show all versions of rxlib Show documentation
A set of utilities for Java
package org.rx.bean;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import org.rx.core.EventArgs;
import org.rx.util.function.Func;
import java.util.Set;
@Getter
@RequiredArgsConstructor
public class ProceedEventArgs extends EventArgs {
private static final long serialVersionUID = -2969747570419733673L;
private final Class> declaringType;
private final Object[] parameters;
private final boolean isVoid;
private Object returnValue;
private long elapsedNanos = -1;
@Setter
private Throwable error;
@Setter
private LogStrategy logStrategy;
@Setter
private Set logTypeWhitelist;
public T proceed(@NonNull Func proceed) throws Throwable {
long start = System.nanoTime();
try {
T retVal = proceed.invoke();
returnValue = retVal;
return retVal;
} finally {
elapsedNanos = System.nanoTime() - start;
}
}
}