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

events.Error Maven / Gradle / Ivy

Go to download

Java support for Cloud Foundry's Loggregator using the Dropsonde protocol.

There is a newer version: 0.5
Show newest version
// Code generated by Wire protocol buffer compiler, do not edit.
// Source file: /Users/mheath/projects/snotel/target/checkout/client/src/main/proto/events/error.proto
package events;

import com.squareup.wire.Message;
import com.squareup.wire.ProtoField;

import static com.squareup.wire.Message.Datatype.INT32;
import static com.squareup.wire.Message.Datatype.STRING;
import static com.squareup.wire.Message.Label.REQUIRED;

/**
 * / An Error event represents an error in the originating process.
 */
public final class Error extends Message {

  public static final String DEFAULT_SOURCE = "";
  public static final Integer DEFAULT_CODE = 0;
  public static final String DEFAULT_MESSAGE = "";

  @ProtoField(tag = 1, type = STRING, label = REQUIRED)
  public final String source;

  /**
   * / Source of the error. This may or may not be the same as the Origin in the envelope.
   */
  @ProtoField(tag = 2, type = INT32, label = REQUIRED)
  public final Integer code;

  /**
   * / Numeric error code. This is provided for programmatic responses to the error.
   */
  @ProtoField(tag = 3, type = STRING, label = REQUIRED)
  public final String message;

  public Error(String source, Integer code, String message) {
    this.source = source;
    this.code = code;
    this.message = message;
  }

  private Error(Builder builder) {
    this(builder.source, builder.code, builder.message);
    setBuilder(builder);
  }

  @Override
  public boolean equals(Object other) {
    if (other == this) return true;
    if (!(other instanceof Error)) return false;
    Error o = (Error) other;
    return equals(source, o.source)
        && equals(code, o.code)
        && equals(message, o.message);
  }

  @Override
  public int hashCode() {
    int result = hashCode;
    if (result == 0) {
      result = source != null ? source.hashCode() : 0;
      result = result * 37 + (code != null ? code.hashCode() : 0);
      result = result * 37 + (message != null ? message.hashCode() : 0);
      hashCode = result;
    }
    return result;
  }

  public static final class Builder extends Message.Builder {

    public String source;
    public Integer code;
    public String message;

    public Builder() {
    }

    public Builder(Error message) {
      super(message);
      if (message == null) return;
      this.source = message.source;
      this.code = message.code;
      this.message = message.message;
    }

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

    /**
     * / Source of the error. This may or may not be the same as the Origin in the envelope.
     */
    public Builder code(Integer code) {
      this.code = code;
      return this;
    }

    /**
     * / Numeric error code. This is provided for programmatic responses to the error.
     */
    public Builder message(String message) {
      this.message = message;
      return this;
    }

    @Override
    public Error build() {
      checkRequiredFields();
      return new Error(this);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy