org.snapscript.studio.agent.debug.ThreadStackGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap-all Show documentation
Show all versions of snap-all Show documentation
Dynamic scripting for the JVM
package org.snapscript.studio.agent.debug;
import org.snapscript.core.stack.ThreadStack;
public class ThreadStackGenerator {
private final ThreadStack stack;
public ThreadStackGenerator(ThreadStack stack) {
this.stack = stack;
}
public String generate() {
StackTraceElement[] elements = stack.build();
if(elements.length > 0) {
StringBuilder builder = new StringBuilder();
for(StackTraceElement element : elements){
builder.append(element);
builder.append("\n");
}
return builder.toString();
}
return "";
}
}