001/*
002 * Copyright 2014 Global Biodiversity Information Facility (GBIF)
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.gbif.api.model.common;
017
018import com.google.common.base.Objects;
019
020/**
021 * Allows for encapsulating a verbatim and an interpreted value of any type.
022 */
023@Deprecated
024public class InterpretedField<V, I> {
025
026  private V verbatim;
027  private I interpreted;
028
029  public InterpretedField() {
030  }
031
032  public InterpretedField(V verbatim, I interpreted) {
033    this.verbatim = verbatim;
034    this.interpreted = interpreted;
035  }
036
037  public I getInterpreted() {
038    return interpreted;
039  }
040
041  public void setInterpreted(I interpreted) {
042    this.interpreted = interpreted;
043  }
044
045  public V getVerbatim() {
046    return verbatim;
047  }
048
049  public void setVerbatim(V verbatim) {
050    this.verbatim = verbatim;
051  }
052
053  @Override
054  public boolean equals(Object object) {
055    if (this == object) {
056      return true;
057    }
058    if (!(object instanceof InterpretedField)) {
059      return false;
060    }
061
062    InterpretedField<?, ?> that = (InterpretedField<?, ?>) object;
063    return Objects.equal(this.verbatim, that.getVerbatim())
064           && Objects.equal(this.interpreted, that.getInterpreted());
065  }
066
067  @Override
068  public int hashCode() {
069    return Objects.hashCode(verbatim, interpreted);
070  }
071
072  @Override
073  public String toString() {
074    return Objects.toStringHelper(this).add("verbatim", verbatim).add("interpreted", interpreted).toString();
075  }
076
077}