diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java b/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java index a99ea56..82be9f2 100644 --- a/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java +++ b/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java @@ -21,6 +21,7 @@ import java.util.HashSet; import java.util.Set;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.math.BigDecimal;
import org.cojen.classfile.ClassFile;
import org.cojen.classfile.Modifiers;
@@ -448,6 +449,11 @@ public class CodeBuilderUtil { b.invokeVirtual(TypeDesc.DOUBLE.toObjectType(), "compareTo", TypeDesc.INT,
new TypeDesc[] {TypeDesc.DOUBLE.toObjectType()});
return choice ? "==" : "!=";
+ } else if (BigDecimal.class.isAssignableFrom(fieldType.toClass())) {
+ // Call compareTo to disregard scale.
+ TypeDesc bdType = TypeDesc.forClass(BigDecimal.class);
+ b.invokeVirtual(bdType, "compareTo", TypeDesc.INT, new TypeDesc[] {bdType});
+ return choice ? "==" : "!=";
} else {
TypeDesc[] params = {TypeDesc.OBJECT};
if (fieldType.toClass() != null) {
|