Coverage Summary for Class: KeyBox (net.sf.persism)
Class |
Class, %
|
Method, %
|
Line, %
|
KeyBox |
100%
(1/1)
|
100%
(4/4)
|
87.5%
(14/16)
|
1 package net.sf.persism;
2
3 import java.util.Arrays;
4
5 // wrapper class for when you join on multiple columns
6 final class KeyBox {
7
8 final Object[] keyValues;
9
10 public KeyBox(boolean caseSensitive, Object... keyValues) {
11 this.keyValues = keyValues;
12
13 // If not case-sensitive then make String values upper case
14 if (!caseSensitive) {
15 for (int j = 0; j < keyValues.length; j++) {
16 if (keyValues[j] instanceof String s) {
17 s = s.toUpperCase();
18 this.keyValues[j] = s;
19 }
20 }
21 }
22 }
23
24 @Override
25 public boolean equals(Object o) {
26 if (this == o) {
27 return true;
28 }
29 if (o == null || getClass() != o.getClass()) {
30 return false;
31 }
32 KeyBox keyBox = (KeyBox) o;
33 return Arrays.equals(keyValues, keyBox.keyValues);
34 }
35
36 @Override
37 public int hashCode() {
38 return Arrays.hashCode(keyValues);
39 }
40
41 @Override
42 public String toString() {
43 return "KeyBox{" +
44 "keyValues=" + Arrays.toString(keyValues) +
45 '}';
46 }
47 }