diff options
author | Jeff Schumacher <jeffschu@google.com> | 2010-07-28 12:59:06 -0700 |
---|---|---|
committer | Jeff Schumacher <jeffschu@google.com> | 2010-07-28 13:55:58 -0700 |
commit | 9966fb0b39b34cde88b8d0956dff5c6cf25848a4 (patch) | |
tree | 1922f59fa0dc9e8e4c7924d0585a9314fb6f3e5a | |
parent | 9a9c21d675cbb7a15ec57d8f3cf4e08ab0831949 (diff) | |
download | gwtorm-9966fb0b39b34cde88b8d0956dff5c6cf25848a4.tar.gz |
Added code to check that objects have @Column annotations
If a class to be encoded has no @Column annotations the CodecGen
should throw an Exception, as a class with no @Column annotations
cannot be correctly represented on protobuf. I added a check to
scanFields to check for this, and throw an appropriate exception.
Change-Id: Ib6962d1b2e05e5b494ca0cee2091caa1f5daa731
-rw-r--r-- | src/main/java/com/google/gwtorm/protobuf/CodecGen.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/java/com/google/gwtorm/protobuf/CodecGen.java b/src/main/java/com/google/gwtorm/protobuf/CodecGen.java index 5a5342b..2aaf841 100644 --- a/src/main/java/com/google/gwtorm/protobuf/CodecGen.java +++ b/src/main/java/com/google/gwtorm/protobuf/CodecGen.java @@ -121,6 +121,10 @@ class CodecGen<T> implements Opcodes { } in = in.getSuperclass(); } + if (col.isEmpty()) { + throw new OrmException( + "Cannot create new encoder, no @Column fields found"); + } return sort(col); } |