
com.github.valid8j.pcond.core.DebuggingUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of valid8j Show documentation
Show all versions of valid8j Show documentation
Java Library Providing Uniformed Programming Experiences across DbC, Value Checking, and Test Assertions
The newest version!
package com.github.valid8j.pcond.core;
import com.github.valid8j.pcond.validator.Validator;
import com.github.valid8j.pcond.internals.InternalUtils;
import java.io.PrintStream;
public enum DebuggingUtils {
;
static void printIo(String x, EvaluableIo, R> io) {
if (isDebugLogEnabled())
System.err.println(x + ":" + io.evaluableType() + ":" + io.evaluable() + "(" + io.input() + ")=" + io.output());
}
static void printInput(String x, Evaluable evaluable, ValueHolder input) {
if (isDebugLogEnabled())
System.err.println(x + ":" + evaluable + "(" + input + ")");
}
static void printInputAndOutput(Evaluable evaluable, ValueHolder input, ValueHolder output) {
if (isDebugLogEnabled())
System.err.println("TRANSFORMATION:AFTER" + ":" + evaluable + "(" + input + ")=" + output);
}
static void printTo(EvaluationContext evaluationContext, PrintStream ps, int indent) {
if (isDebugLogEnabled()) {
ps.println(InternalUtils.indent(indent) + "context=<" + evaluationContext + ">");
for (Object each : evaluationContext.resultEntries()) {
ps.println(InternalUtils.indent(indent + 1) + each);
}
}
}
public static boolean showEvaluableDetail() {
return Validator.instance().configuration().debugging().map(Validator.Configuration.Debugging::showEvaluableDetail).orElse(false);
}
public static boolean suppressSquashing() {
return Validator.instance().configuration().debugging().map(Validator.Configuration.Debugging::suppressSquashing).orElse(false);
}
public static boolean isDebugLogEnabled() {
return Validator.instance().configuration().debugging().map(Validator.Configuration.Debugging::enableDebugLog).orElse(false);
}
public static boolean reportIgnoredEntries() {
return Validator.instance().configuration().debugging().map(Validator.Configuration.Debugging::reportIgnoredEntries).orElse(false);
}
public static boolean passThroughComparisonFailure() {
return Validator.instance().configuration().debugging().map(Validator.Configuration.Debugging::passThroughComparisonFailure).orElse(false);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy