File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed
app/com/github/cleverage/elasticsearch
test/com/github/cleverage/elasticsearch Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change 4
4
import play .Logger ;
5
5
6
6
import java .math .BigDecimal ;
7
- import java .util .ArrayList ;
8
- import java .util .Date ;
9
- import java .util .List ;
10
- import java .util .Map ;
7
+ import java .util .*;
11
8
12
9
public abstract class IndexUtils {
13
10
@@ -128,6 +125,9 @@ else if (targetType.equals(Float.class)) {
128
125
return Float .valueOf (value .toString ());
129
126
}
130
127
}
128
+ else if (targetType .equals (UUID .class )) {
129
+ return UUID .fromString ((String ) value );
130
+ }
131
131
else {
132
132
return value ;
133
133
}
Original file line number Diff line number Diff line change
1
+ package com .github .cleverage .elasticsearch ;
2
+
3
+ import org .junit .Test ;
4
+
5
+ import java .util .UUID ;
6
+
7
+ import static org .junit .Assert .assertEquals ;
8
+
9
+ /**
10
+ *
11
+ * @author Hossein Kazemi
12
+ */
13
+ public class IndexUtilsTest {
14
+ @ Test
15
+ public void shouldConvertValue () throws Exception {
16
+ UUID uuid = UUID .randomUUID ();
17
+ String uuidString = uuid .toString ();
18
+ UUID conversionResult = (UUID ) IndexUtils .convertValue (uuidString , UUID .class );
19
+ assertEquals (uuid , conversionResult );
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments