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

org.rx.bean.ProceedEventArgs Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
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;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy