View Javadoc
1   /*
2    *    Copyright 2009-2021 the original author or authors.
3    *
4    *    Licensed under the Apache License, Version 2.0 (the "License");
5    *    you may not use this file except in compliance with the License.
6    *    You may obtain a copy of the License at
7    *
8    *       http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *    Unless required by applicable law or agreed to in writing, software
11   *    distributed under the License is distributed on an "AS IS" BASIS,
12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *    See the License for the specific language governing permissions and
14   *    limitations under the License.
15   */
16  package org.apache.ibatis.submitted.nestedresulthandler_multiple_association;
17  
18  public class Binome<T, U> {
19    private T one;
20    private U two;
21  
22    public Binome() {
23    }
24  
25    public Binome(final T one, final U two) {
26      this.one = one;
27      this.two = two;
28    }
29  
30    public T getOne() {
31      return one;
32    }
33  
34    public void setOne(T one) {
35      this.one = one;
36    }
37  
38    public U getTwo() {
39      return two;
40    }
41  
42    public void setTwo(U two) {
43      this.two = two;
44    }
45  
46    @Override
47    public int hashCode() {
48      return (one != null ? one.hashCode() : 0)
49          + (two != null ? two.hashCode() : 0);
50    }
51  
52    @Override
53    public boolean equals(final Object obj) {
54      if (obj instanceof Binome<?, ?>) {
55        Binome<?, ?> bin = (Binome<?, ?>) obj;
56        return one != null && one.equals(bin.getOne()) && two != null
57            && two.equals(bin.getTwo());
58      }
59      return super.equals(obj);
60    }
61  
62    @Override
63    public String toString() {
64      return "Binome [one=" + one + ", two=" + two + "]";
65    }
66  }