View Javadoc
1   package com.github.davidmoten.rx.jdbc.tuple;
2   
3   /**
4    * An explicitly typed tuple.
5    * 
6    * @param <T1>
7    * @param <T2>
8    * @param <T3>
9    * @param <T4>
10   * @param <T5>
11   */
12  public class Tuple5<T1, T2, T3, T4, T5> {
13  
14      private final T1 value1;
15      private final T2 value2;
16      private final T3 value3;
17      private final T4 value4;
18      private final T5 value5;
19  
20      /**
21       * Constructor.
22       * 
23       * @param value1
24       * @param value2
25       * @param value3
26       * @param value4
27       * @param value5
28       */
29      public Tuple5(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5) {
30          this.value1 = value1;
31          this.value2 = value2;
32          this.value3 = value3;
33          this.value4 = value4;
34          this.value5 = value5;
35      }
36  
37      public T1 value1() {
38          return value1;
39      }
40  
41      public T2 value2() {
42          return value2;
43      }
44  
45      public T3 value3() {
46          return value3;
47      }
48  
49      public T4 value4() {
50          return value4;
51      }
52  
53      public T5 value5() {
54          return value5;
55      }
56  
57      @Override
58      public int hashCode() {
59          final int prime = 31;
60          int result = 1;
61          result = prime * result + ((value1 == null) ? 0 : value1.hashCode());
62          result = prime * result + ((value2 == null) ? 0 : value2.hashCode());
63          result = prime * result + ((value3 == null) ? 0 : value3.hashCode());
64          result = prime * result + ((value4 == null) ? 0 : value4.hashCode());
65          result = prime * result + ((value5 == null) ? 0 : value5.hashCode());
66          return result;
67      }
68  
69      @Override
70      public boolean equals(Object obj) {
71          if (this == obj)
72              return true;
73          if (obj == null)
74              return false;
75          if (getClass() != obj.getClass())
76              return false;
77          Tuple5<?, ?, ?, ?, ?> other = (Tuple5<?, ?, ?, ?, ?>) obj;
78          if (value1 == null) {
79              if (other.value1 != null)
80                  return false;
81          } else if (!value1.equals(other.value1))
82              return false;
83          if (value2 == null) {
84              if (other.value2 != null)
85                  return false;
86          } else if (!value2.equals(other.value2))
87              return false;
88          if (value3 == null) {
89              if (other.value3 != null)
90                  return false;
91          } else if (!value3.equals(other.value3))
92              return false;
93          if (value4 == null) {
94              if (other.value4 != null)
95                  return false;
96          } else if (!value4.equals(other.value4))
97              return false;
98          if (value5 == null) {
99              if (other.value5 != null)
100                 return false;
101         } else if (!value5.equals(other.value5))
102             return false;
103         return true;
104     }
105 
106     @Override
107     public String toString() {
108         return "Tuple5 [value1=" + value1 + ", value2=" + value2 + ", value3=" + value3
109                 + ", value4=" + value4 + ", value5=" + value5 + "]";
110     }
111 
112 }