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

com.undefinedlabs.scope.context.ContextContainer Maven / Gradle / Ivy

package com.undefinedlabs.scope.context;

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

public class ContextContainer {

  private final Thread origThread;
  private final ImmutableContext context;

  public ContextContainer(final Thread origThread, final ImmutableContext context) {
    this.origThread = origThread;
    this.context = context;
  }

  public Thread getOrigThread() {
    return origThread;
  }

  public ImmutableContext getContext() {
    return context;
  }

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

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

    final ContextContainer that = (ContextContainer) o;

    return new EqualsBuilder()
        .append(origThread, that.origThread)
        .append(context, that.context)
        .isEquals();
  }

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy