package com.rollbar.payload.data.body;

import com.rollbar.payload.utilities.ArgumentNullException;
import com.rollbar.payload.utilities.Validate;

public class Trace implements BodyContents {
    public static Trace fromThrowable(Throwable error) throws ArgumentNullException {
        Validate.isNotNull(error, "error");

        Frame[] frames = Frame.fromThrowable(error);
        ExceptionInfo exceptionInfo = ExceptionInfo.fromThrowable(error);

        return new Trace(frames, exceptionInfo);
    }

    private final Frame[] frames;
    private final ExceptionInfo exception;

    public Trace(Frame[] frames, ExceptionInfo exception) throws ArgumentNullException {
        Validate.isNotNull(frames, "frames");
        this.frames = frames.clone();
        Validate.isNotNull(exception, "exception");
        this.exception = exception;
    }

    public Frame[] frames() {
        return this.frames.clone();
    }

    public Trace frames(Frame[] frames) throws ArgumentNullException {
        return new Trace(frames, exception);
    }

    public ExceptionInfo exception() {
        return this.exception;
    }

    public Trace exception(ExceptionInfo exception) throws ArgumentNullException {
        return new Trace(frames, exception);
    }
}

@@ -145,52 +145,336 @@
 e;%0A%0A
-public class Trace implements BodyContents %7B
+/**%0A * Represent a Stack Trace to send to Rollbar%0A */%0Apublic class Trace implements BodyContents %7B%0A    /**%0A     * Create a stack trace from a throwable%0A     * @param error the Throwable to create a stack trace from%0A     * @return the Trace representing the Throwable%0A     * @throws ArgumentNullException if error is null%0A     */
 %0A   
@@ -863,16 +863,244 @@
 ption;%0A%0A
+    /**%0A     * Constructor%0A     * @param frames not nullable, frames making up the exception%0A     * @param exception not nullable, info about the exception%0A     * @throws ArgumentNullException if either argument is null%0A     */%0A
     publ
@@ -1351,32 +1351,84 @@
 ception;%0A    %7D%0A%0A
+    /**%0A     * @return a copy of the frames%0A     */%0A
     public Frame
@@ -1476,32 +1476,244 @@
 clone();%0A    %7D%0A%0A
+    /**%0A     * Set frames on a copy of this Trace%0A     * @param frames the frames to set%0A     * @return a copy of this Trace with frames overridden%0A     * @throws ArgumentNullException if frames are null%0A     */%0A
     public Trace
@@ -1811,32 +1811,82 @@
 eption);%0A    %7D%0A%0A
+    /**%0A     * @return the exception info%0A     */%0A
     public Excep
@@ -1942,24 +1942,249 @@
 ion;%0A    %7D%0A%0A
+    /**%0A     * Set the exception on a copy of this Trace%0A     * @param exception the new exception info%0A     * @return a copy of this Trace with exception set%0A     * @throws ArgumentNullException if exception is null%0A     */%0A
     public T

document trace