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

com.undefinedlabs.scope.events.exception.ThrowableEvent Maven / Gradle / Ivy

package com.undefinedlabs.scope.events.exception;

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

public class ThrowableEvent {

  private final String eventType;
  private final Throwable throwable;
  private final String source;

  public ThrowableEvent(Builder builder) {
    this.eventType = builder.eventType;
    this.throwable = builder.throwable;
    this.source = builder.source;
  }

  public String getEventType() {
    return eventType;
  }

  public Throwable getThrowable() {
    return throwable;
  }

  public String getSource() {
    return source;
  }

  public static Builder newBuilder() {
    return new Builder();
  }

  public static class Builder {
    private String eventType;
    private Throwable throwable;
    private String source;

    public Builder withEventType(final String eventType) {
      this.eventType = eventType;
      return this;
    }

    public Builder withThrowable(final Throwable throwable) {
      this.throwable = throwable;
      return this;
    }

    public Builder withSource(final String source) {
      this.source = source;
      return this;
    }

    public ThrowableEvent build() {
      return new ThrowableEvent(this);
    }
  }

  @Override
  public String toString() {
    return new ToStringBuilder(this)
        .append("eventType", eventType)
        .append("throwable", throwable)
        .append("source", source)
        .toString();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy