You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gora.apache.org by hs...@apache.org on 2011/06/23 15:13:38 UTC
svn commit: r1138866 - in /incubator/gora/trunk: CHANGES.txt
gora-core/src/main/java/org/apache/gora/compiler/GoraCompiler.java
Author: hsaputra
Date: Thu Jun 23 13:13:38 2011
New Revision: 1138866
URL: http://svn.apache.org/viewvc?rev=1138866&view=rev
Log:
GORA-32. Map type with long values generates non-compilable Java class | Patch from Yves Langisch
Modified:
incubator/gora/trunk/CHANGES.txt
incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/compiler/GoraCompiler.java
Modified: incubator/gora/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/CHANGES.txt?rev=1138866&r1=1138865&r2=1138866&view=diff
==============================================================================
--- incubator/gora/trunk/CHANGES.txt (original)
+++ incubator/gora/trunk/CHANGES.txt Thu Jun 23 13:13:38 2011
@@ -2,6 +2,7 @@ Gora Change Log
Trunk (unreleased changes):
+* GORA-32. Map type with long values generates non-compilable Java class (Yves Langisch)
* GORA-29. Gora maven support (Ioannis Canellos via mattmann)
Modified: incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/compiler/GoraCompiler.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/compiler/GoraCompiler.java?rev=1138866&r1=1138865&r2=1138866&view=diff
==============================================================================
--- incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/compiler/GoraCompiler.java (original)
+++ incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/compiler/GoraCompiler.java Thu Jun 23 13:13:38 2011
@@ -314,8 +314,9 @@ public class GoraCompiler {
case INT:case LONG:case FLOAT:case DOUBLE:
case BOOLEAN:case BYTES:case STRING: case ENUM: case RECORD:
String unboxed = unbox(fieldSchema);
+ String fieldType = type(fieldSchema);
line(1, "public "+unboxed+" get" +camelKey+"() {");
- line(2, "return ("+type(field.schema())+") get("+i+");");
+ line(2, "return ("+fieldType+") get("+i+");");
line(1, "}");
line(1, "public void set"+camelKey+"("+unboxed+" value) {");
line(2, "put("+i+", value);");
@@ -323,9 +324,9 @@ public class GoraCompiler {
break;
case ARRAY:
unboxed = unbox(fieldSchema.getElementType());
-
- line(1, "public GenericArray<"+unboxed+"> get"+camelKey+"() {");
- line(2, "return (GenericArray<"+unboxed+">) get("+i+");");
+ fieldType = type(fieldSchema.getValueType());
+ line(1, "public GenericArray<"+fieldType+"> get"+camelKey+"() {");
+ line(2, "return (GenericArray<"+fieldType+">) get("+i+");");
line(1, "}");
line(1, "public void addTo"+camelKey+"("+unboxed+" element) {");
line(2, "getStateManager().setDirty(this, "+i+");");
@@ -334,10 +335,11 @@ public class GoraCompiler {
break;
case MAP:
unboxed = unbox(fieldSchema.getValueType());
- line(1, "public Map<Utf8, "+unboxed+"> get"+camelKey+"() {");
- line(2, "return (Map<Utf8, "+unboxed+">) get("+i+");");
+ fieldType = type(fieldSchema.getValueType());
+ line(1, "public Map<Utf8, "+fieldType+"> get"+camelKey+"() {");
+ line(2, "return (Map<Utf8, "+fieldType+">) get("+i+");");
line(1, "}");
- line(1, "public "+unboxed+" getFrom"+camelKey+"(Utf8 key) {");
+ line(1, "public "+fieldType+" getFrom"+camelKey+"(Utf8 key) {");
line(2, "if ("+field.name()+" == null) { return null; }");
line(2, "return "+field.name()+".get(key);");
line(1, "}");
@@ -345,7 +347,7 @@ public class GoraCompiler {
line(2, "getStateManager().setDirty(this, "+i+");");
line(2, field.name()+".put(key, value);");
line(1, "}");
- line(1, "public "+unboxed+" removeFrom"+camelKey+"(Utf8 key) {");
+ line(1, "public "+fieldType+" removeFrom"+camelKey+"(Utf8 key) {");
line(2, "if ("+field.name()+" == null) { return null; }");
line(2, "getStateManager().setDirty(this, "+i+");");
line(2, "return "+field.name()+".remove(key);");