Permalink
Browse files

support for UUID in automated mapping

  • Loading branch information...
1 parent 5c05d11 commit 6fb430fb88986e65f0df73848e4e897aa24d6dc9 Raffael Stein committed Jul 26, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/main/java/com/netflix/astyanax/mapping/Coercions.java
View
5 src/main/java/com/netflix/astyanax/mapping/Coercions.java
@@ -5,6 +5,7 @@
import java.lang.reflect.Field;
import java.util.Date;
+import java.util.UUID;
class Coercions {
static <T> void setFieldFromColumn(T instance, Field field,
@@ -36,6 +37,8 @@
objValue = column.getStringValue();
} else if (field.getType() == byte[].class) {
objValue = column.getByteArrayValue();
+ } else if (field.getType() == UUID.class) {
+ objValue = column.getUUIDValue();
} else {
throw new UnsupportedOperationException();
}
@@ -80,6 +83,8 @@
mutation.putColumn(columnName, (String) objValue, null);
} else if(objValue.getClass() == byte[].class) {
mutation.putColumn(columnName, (byte[]) objValue, null);
+ } else if (objValue.getClass() == UUID.class) {
+ mutation.putColumn(columnName, (UUID) objValue, null);
} else {
throw new UnsupportedOperationException();
}

1 comment on commit 6fb430f

@mjensen

I just hit the UnsupportedOperationException when trying to use UUID with the cool Mapping feature.
I was very surprised to see that a request to fix had already been made and the fix was already done!

Great job guys!

Is there any guess as to when this fix will be available in a release?

Thanks guys!

Please sign in to comment.