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

com.undefinedlabs.scope.utils.sourcecode.ExceptionSourceCodeFrame Maven / Gradle / Ivy

package com.undefinedlabs.scope.utils.sourcecode;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

public class ExceptionSourceCodeFrame {

  private final Throwable userThrowable;
  private final SourceCodeFrame sourceCodeFrame;

  public ExceptionSourceCodeFrame(
      final Throwable userThrowable, final SourceCodeFrame sourceCodeFrame) {
    this.userThrowable = userThrowable;
    this.sourceCodeFrame = sourceCodeFrame;
  }

  public Throwable getUserThrowable() {
    return userThrowable;
  }

  public SourceCodeFrame getSourceCodeFrame() {
    return sourceCodeFrame;
  }

  @Override
  public boolean equals(final Object o) {
    if (this == o) {
      return true;
    }

    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    final ExceptionSourceCodeFrame that = (ExceptionSourceCodeFrame) o;

    return new EqualsBuilder()
        .append(userThrowable, that.userThrowable)
        .append(sourceCodeFrame, that.sourceCodeFrame)
        .isEquals();
  }

  @Override
  public int hashCode() {
    return new HashCodeBuilder(17, 37).append(userThrowable).append(sourceCodeFrame).toHashCode();
  }

  @Override
  public String toString() {
    return new ToStringBuilder(this)
        .append("userThrowable", userThrowable)
        .append("sourceCodeFrame", sourceCodeFrame)
        .toString();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy