Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISPN-287] ( Querying to support arbitrary key types (not just String) )
- Loading branch information
1 parent
aa96feb
commit e3f92dd
Showing
7 changed files
with
183 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 49 additions & 19 deletions
68
query/src/test/java/org/infinispan/query/test/CustomKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,65 @@ | ||
package org.infinispan.query.test; | ||
|
||
import org.infinispan.query.Transformable; | ||
|
||
/** | ||
* Test class used as a transformable. Used to test the code in {@link org.infinispan.query.backend.KeyTransformationHandler} | ||
* through the {@link org.infinispan.query.backend.KeyTransformationHandlerTest} | ||
* | ||
* @author Navin Surtani | ||
*/ | ||
import org.infinispan.query.backend.KeyTransformationHandlerTest; | ||
|
||
@Transformable(transformer = CustomTransformer.class) | ||
public class CustomKey { | ||
|
||
private String name; | ||
private int aNumber; | ||
int i, j, k; | ||
|
||
public CustomKey(int i, int j, int k) { | ||
this.i = i; | ||
this.j = j; | ||
this.k = k; | ||
} | ||
|
||
public CustomKey() { | ||
} | ||
|
||
public int getI() { | ||
return i; | ||
} | ||
|
||
public void setI(int i) { | ||
this.i = i; | ||
} | ||
|
||
public CustomKey(String name, int aNumber){ | ||
this.name = name; | ||
this.aNumber = aNumber; | ||
public int getJ() { | ||
return j; | ||
} | ||
|
||
public String getName(){ | ||
return name; | ||
public void setJ(int j) { | ||
this.j = j; | ||
} | ||
|
||
public int getANumber(){ | ||
return aNumber; | ||
public int getK() { | ||
return k; | ||
} | ||
|
||
public void setK(int k) { | ||
this.k = k; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
CustomKey customKey = (CustomKey) o; | ||
|
||
if (i != customKey.i) return false; | ||
if (j != customKey.j) return false; | ||
if (k != customKey.k) return false; | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public String toString(){ | ||
return "aNumber=" + aNumber + ";name=" + name; | ||
public int hashCode() { | ||
int result = i; | ||
result = 31 * result + j; | ||
result = 31 * result + k; | ||
return result; | ||
} | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
query/src/test/java/org/infinispan/query/test/CustomKey2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package org.infinispan.query.test; | ||
|
||
import org.infinispan.query.Transformable; | ||
|
||
import java.io.Serializable; | ||
|
||
@Transformable | ||
public class CustomKey2 implements Serializable { | ||
int i, j, k; | ||
|
||
public CustomKey2(int i, int j, int k) { | ||
this.i = i; | ||
this.j = j; | ||
this.k = k; | ||
} | ||
|
||
public CustomKey2() { | ||
} | ||
|
||
public int getI() { | ||
return i; | ||
} | ||
|
||
public void setI(int i) { | ||
this.i = i; | ||
} | ||
|
||
public int getJ() { | ||
return j; | ||
} | ||
|
||
public void setJ(int j) { | ||
this.j = j; | ||
} | ||
|
||
public int getK() { | ||
return k; | ||
} | ||
|
||
public void setK(int k) { | ||
this.k = k; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
CustomKey2 that = (CustomKey2) o; | ||
|
||
if (i != that.i) return false; | ||
if (j != that.j) return false; | ||
if (k != that.k) return false; | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = i; | ||
result = 31 * result + j; | ||
result = 31 * result + k; | ||
return result; | ||
} | ||
} |
Oops, something went wrong.