Re: [protobuf] EnumValueDescriptor doesn't provide toString()?
Right, because none of the other field value types are descriptors. I see your point -- since getField() returns an Object, it would certainly be nice to be able to call toString() on it without knowing the type. But, it's also important that EnumValueDescriptor be consistent with other descriptor classes, so we want to be careful not to mess up that consistency. Instead of calling toString(), you could call TextFormat.printFieldToString() to get a string representation of the field, although it will include the field name. On Mon, May 10, 2010 at 9:17 PM, Christopher Smith cbsm...@gmail.comwrote: Actually, toString() seems to work for me for every other value I get from a dynamic message *except* enums. --Chris On May 10, 2010, at 8:32 PM, Kenton Varda ken...@google.com wrote: I don't think we should add toString() to any of the descriptor classes unless we are going to implement it for *all* of them in some consistent way. If we fill them in ad-hoc then they may be inconsistent, and we may not be able to change them to make them consistent without breaking users. On Mon, May 10, 2010 at 9:49 AM, Christopher Smith cbsm...@gmail.com cbsm...@gmail.com wrote: I noticed EnumValueDescriptor uses the default toString() method. Why not override it to call getFullName()? --Chris -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf%2bunsubscr...@googlegroups.com protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
Re: [protobuf] EnumValueDescriptor doesn't provide toString()?
I grok the problem now. This is the only descriptor that is also a value. Probably should have a method/visitor specifically for getting the value string of an object that isn't implemented by descriptors. --Chris On May 17, 2010, at 12:35 PM, Kenton Varda ken...@google.com wrote: Right, because none of the other field value types are descriptors. I see your point -- since getField() returns an Object, it would certainly be nice to be able to call toString() on it without knowing the type. But, it's also important that EnumValueDescriptor be consistent with other descriptor classes, so we want to be careful not to mess up that consistency. Instead of calling toString(), you could call TextFormat.printFieldToString() to get a string representation of the field, although it will include the field name. On Mon, May 10, 2010 at 9:17 PM, Christopher Smith cbsm...@gmail.com wrote: Actually, toString() seems to work for me for every other value I get from a dynamic message *except* enums. --Chris On May 10, 2010, at 8:32 PM, Kenton Varda ken...@google.com wrote: I don't think we should add toString() to any of the descriptor classes unless we are going to implement it for *all* of them in some consistent way. If we fill them in ad-hoc then they may be inconsistent, and we may not be able to change them to make them consistent without breaking users. On Mon, May 10, 2010 at 9:49 AM, Christopher Smith cbsm...@gmail.com wrote: I noticed EnumValueDescriptor uses the default toString() method. Why not override it to call getFullName()? --Chris -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
Re: [protobuf] EnumValueDescriptor doesn't provide toString()?
I don't think we should add toString() to any of the descriptor classes unless we are going to implement it for *all* of them in some consistent way. If we fill them in ad-hoc then they may be inconsistent, and we may not be able to change them to make them consistent without breaking users. On Mon, May 10, 2010 at 9:49 AM, Christopher Smith cbsm...@gmail.comwrote: I noticed EnumValueDescriptor uses the default toString() method. Why not override it to call getFullName()? --Chris -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
Re: [protobuf] EnumValueDescriptor doesn't provide toString()?
Actually, toString() seems to work for me for every other value I get from a dynamic message *except* enums. --Chris On May 10, 2010, at 8:32 PM, Kenton Varda ken...@google.com wrote: I don't think we should add toString() to any of the descriptor classes unless we are going to implement it for *all* of them in some consistent way. If we fill them in ad-hoc then they may be inconsistent, and we may not be able to change them to make them consistent without breaking users. On Mon, May 10, 2010 at 9:49 AM, Christopher Smith cbsm...@gmail.com wrote: I noticed EnumValueDescriptor uses the default toString() method. Why not override it to call getFullName()? --Chris -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.