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

com.getperka.cli.logging.model.Source Maven / Gradle / Ivy

There is a newer version: 1.18
Show newest version
package com.getperka.cli.logging.model;
/**
   * Describes where a message originated from. In general, properties in this
   * class should be invariants that are useful for aggregation.
   */
@javax.annotation.Generated(value="org.jsonddl.generator.industrial.IndustrialDialect", date="2012-11-08T13:37:09")
public interface Source
    extends org.jsonddl.JsonDdlObject
 {
  /**
   * Constructs instances of {@link Source}. Instances of Builder should not be
   * reused after calling {@link #build()}.
   */
  @javax.annotation.Generated(value="org.jsonddl.generator.industrial.IndustrialDialect", date="2012-11-08T13:37:09")
  public static class Builder
      implements org.jsonddl.JsonDdlObject.Builder,  org.jsonddl.impl.Traversable, org.jsonddl.impl.Digested, Source {
    private Source built;
    private SourceImpl obj;
    public Builder() {
      this(new SourceImpl());
    }
    Builder(SourceImpl instance) {
      this.obj = instance;
    }
    public Source.Builder accept(org.jsonddl.JsonDdlVisitor visitor) {
      obj = new org.jsonddl.impl.ContextImpl.ObjectContext.Builder()
          .withValue(this)
          .withKind(org.jsonddl.model.Kind.DDL)
          .withMutability(true)
          .build().traverse(visitor).builder().obj;
      return this;
    }
    public Source build() {
      // Prevent build() loops from causing NPE's
      if (built != null) {
        return built;
      }
      SourceImpl toReturn = obj;
      built = toReturn;
      obj = null;
      return toReturn;
    }
    public Source.Builder builder() {
      return this;
    }
    public Source.Builder from(Source copyFrom) {
      withEnvironment(copyFrom.getEnvironment());
      withHostname(copyFrom.getHostname());
      withProcessName(copyFrom.getProcessName());
      withProcessUuid(copyFrom.getProcessUuid());
      return this;
    }
    public Source.Builder from(java.util.Map map) {
      accept(org.jsonddl.impl.JsonMapVisitor.fromJsonMap(map));
      return this;
    }
    public Class getDdlObjectType() {
      return Source.class;
    }
    public Source.Builder newInstance() {
      return new Source.Builder();
    }
    public java.util.Map toJsonObject() {
      return obj.toJsonObject();
    }
    public Source.Builder traverse(org.jsonddl.JsonDdlVisitor visitor) {
      withEnvironment(
      new org.jsonddl.impl.ContextImpl.ValueContext.Builder()
        .withKind(org.jsonddl.model.Kind.STRING)
        .withLeafType(java.lang.String.class)
        .withMutability(true)
        .withProperty("environment")
        .withValue(obj.Environment)
        .build().traverse(visitor));
      withHostname(
      new org.jsonddl.impl.ContextImpl.ValueContext.Builder()
        .withKind(org.jsonddl.model.Kind.STRING)
        .withLeafType(java.lang.String.class)
        .withMutability(true)
        .withProperty("hostname")
        .withValue(obj.Hostname)
        .build().traverse(visitor));
      withProcessName(
      new org.jsonddl.impl.ContextImpl.ValueContext.Builder()
        .withKind(org.jsonddl.model.Kind.STRING)
        .withLeafType(java.lang.String.class)
        .withMutability(true)
        .withProperty("processName")
        .withValue(obj.ProcessName)
        .build().traverse(visitor));
      withProcessUuid(
      new org.jsonddl.impl.ContextImpl.ValueContext.Builder()
        .withKind(org.jsonddl.model.Kind.STRING)
        .withLeafType(java.lang.String.class)
        .withMutability(true)
        .withProperty("processUuid")
        .withValue(obj.ProcessUuid)
        .build().traverse(visitor));
      return this;
    }
    public byte[] computeDigest() {
      byte[] digest;
      org.jsonddl.impl.DigestVisitor v = new org.jsonddl.impl.DigestVisitor();
      accept(v);
      digest = v.getDigest();
      return digest;
    }

    public int hashCode() {
      byte[] digest = computeDigest();
      return (int)((digest[0] << 3) | (digest[1] << 2) | (digest[18] << 1) | digest[19]);
    }

    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof org.jsonddl.impl.Digested)) {
        return false;
      }
      byte[] d1 = computeDigest();
      byte[] d2 = ((org.jsonddl.impl.Digested) o).computeDigest();
      for (int i = 0, j = d1.length; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy