http://codereview.appspot.com/6132056/diff/5012/src/com/google/web/bindery/requestfactory/server/SimpleRequestProcessor.java File src/com/google/web/bindery/requestfactory/server/SimpleRequestProcessor.java (right):
http://codereview.appspot.com/6132056/diff/5012/src/com/google/web/bindery/requestfactory/server/SimpleRequestProcessor.java#newcode523 src/com/google/web/bindery/requestfactory/server/SimpleRequestProcessor.java:523: if (ctx instanceof MapPropertyContext && ((MapPropertyContext)ctx).getKeyType() != null) {
This method is called by both AutoBeanVisitor.visitCollectionProperty and AutoBeanVisitor.visitMapProperty since some of the ctx's
implemented
both MapPropertyContext and CollectionPropertyContext. The null
checked
seemed to safely (as best as I could tell) distinguish the cases.
I haven't looked whether there'd be an alternate approach, but it might at least be worth a comment in the code. http://codereview.appspot.com/6132056/diff/5012/src/com/google/web/bindery/requestfactory/shared/impl/EntityCodex.java File src/com/google/web/bindery/requestfactory/shared/impl/EntityCodex.java (right): http://codereview.appspot.com/6132056/diff/5012/src/com/google/web/bindery/requestfactory/shared/impl/EntityCodex.java#newcode135 src/com/google/web/bindery/requestfactory/shared/impl/EntityCodex.java:135: if (ValueCodex.canDecode(keyType)) {
I originally did as you're suggesting but switched after digging into what AutoBean is doing. From what I could tell from AutoBeanCodexImpl.MapCoder and
http://code.google.com/p/google-web-toolkit/wiki/AutoBean#JSON_structures
AutoBean has been updated to allow non-value type keys; as such I just followed what AutoBean's doing.
Oh, I'm more than OK to mimick AutoBean then! http://codereview.appspot.com/6132056/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors