001package org.gbif.api.model.registry.search;
002
003import java.util.UUID;
004
005import com.google.common.base.Objects;
006
007/**
008 * A utility container for holding only the title and key of an entity.
009 */
010public class KeyTitleResult {
011
012  private UUID key;
013  private String title;
014
015  public KeyTitleResult() {
016  }
017
018  public KeyTitleResult(UUID key, String title) {
019    this.key = key;
020    this.title = title;
021  }
022
023  public UUID getKey() {
024    return key;
025  }
026
027  public void setKey(UUID key) {
028    this.key = key;
029  }
030
031  public String getTitle() {
032    return title;
033  }
034
035  public void setTitle(String title) {
036    this.title = title;
037  }
038
039  @Override
040  public int hashCode() {
041    return Objects
042      .hashCode(key, title);
043  }
044
045  @Override
046  public boolean equals(Object object) {
047    if (object instanceof KeyTitleResult) {
048      KeyTitleResult that = (KeyTitleResult) object;
049      return Objects.equal(this.key, that.key)
050        && Objects.equal(this.title, that.title);
051    }
052    return false;
053  }
054
055  @Override
056  public String toString() {
057    return Objects.toStringHelper(this)
058      .add("key", key)
059      .add("title", title)
060      .toString();
061  }
062}