It looks like I'm running into the problem inside EntityCodex.decode() :  
In the red code below, I see it iterate over all three items in my 
collection, but each time the "element" that comes out of the "decode" call 
has the same hashCode, so the HashSet ignores it.  The hashCode always seems 
to be "1832980284", regardless of what the actual hashCode of my underlying 
object is.

Does anyone know if it is possible to control this behavior?  I guess worst 
case I could change my Set to a List and just remove any duplicates myself, 
but it seems weird to have Set support if it doesn't work right.

Thanks,
Eric


public static Object decode(EntitySource source, Class<?> type, Class<?> 
elementType,
      Splittable split) {
    if (split == null || split == Splittable.NULL) {
      return null;
    }

    // Collection support
    if (elementType != null) {
      Collection<Object> collection = null;
      if (List.class.equals(type)) {
        collection = new ArrayList<Object>();
      } else if (Set.class.equals(type)) {
        collection = new HashSet<Object>();
      } else {
        throw new UnsupportedOperationException();
      }

      // Decode values
      if (ValueCodex.canDecode(elementType)) {
        for (int i = 0, j = split.size(); i < j; i++) {
          if (split.isNull(i)) {
            collection.add(null);
          } else {
            Object element = ValueCodex.decode(elementType, split.get(i));
            collection.add(element);
          }
        }
      } else {
        for (int i = 0, j = split.size(); i < j; i++) {
          if (split.isNull(i)) {
            collection.add(null);
          } else {
            Object element = decode(source, elementType, null, 
split.get(i));
            collection.add(element);
          }
        }
      }
      return collection;
    }

    if (source.isEntityType(type) || source.isValueType(type) || 
EntityProxyId.class.equals(type)) {
      return source.getBeanForPayload(split).as();
    }

    // Fall back to values
    return ValueCodex.decode(type, split);
  }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to