View Javadoc
1   /*
2    *    Copyright 2009-2023 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    *       https://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) + (two != null ? two.hashCode() : 0);
49    }
50  
51    @Override
52    public boolean equals(final Object obj) {
53      if (obj instanceof Binome<?, ?>) {
54        Binome<?, ?> bin = (Binome<?, ?>) obj;
55        return one != null && one.equals(bin.getOne()) && two != null && two.equals(bin.getTwo());
56      }
57      return super.equals(obj);
58    }
59  
60    @Override
61    public String toString() {
62      return "Binome [one=" + one + ", two=" + two + "]";
63    }
64  }