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

io.tracee.contextlogger.api.WrappedContextLoggerOutput Maven / Gradle / Ivy

There is a newer version: 0.11.0
Show newest version
package io.tracee.contextlogger.api;

/**
 * Class for providing output at runtime vi toString.
 */
public class WrappedContextLoggerOutput {

    private final ContextLogger traceeContextLogger;
    private String generatedOutput;
    private final Object[] instancesToOutput;

    private WrappedContextLoggerOutput(ContextLogger traceeContextLogger, Object... instancesToOutput) {
        this.traceeContextLogger = traceeContextLogger;
        this.instancesToOutput = instancesToOutput;
    }

    @Override
    public String toString() {
        if (generatedOutput == null) {
            generatedOutput = (traceeContextLogger != null ? traceeContextLogger.toString(instancesToOutput) : null);
        }

        return generatedOutput;
    }

    public static WrappedContextLoggerOutput wrap(ContextLogger traceeContextLogger, Object... instancesToOutput) {
        return new WrappedContextLoggerOutput(traceeContextLogger, instancesToOutput);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy