I also just double-checked the Enum javadoc because I was curious which
of the following was expected for Enum foo
foo == Enum.valueOf(foo.getClass(), foo.toString())
or
foo == Enum.valueOf(foo.getClass(), foo.name())
It is actually the second of these, so everything is good.
-- Blake
On 2/14/12 9:18 AM, Andy Schwartz wrote:
On Tue, Feb 14, 2012 at 11:33 AM, Blake Sullivan
<[email protected]> wrote:
I would go with valueOfDisplayName(). I would actually add a displayName()
as well, just like we have name().
Sounds good, will do.
I am not a fan of assuming that
toString() == displayName()
Er... two options here:
1. Leave toString() documentation/contract intentionally vague.
2. Document the current behavior (toString() == displayName()) as the
spec'ed/required behavior.
I was leaning towards #2 since folks out there might be relying on the
existing toString() behavior - ie. we could enshrine this as required
behavior in our contract.
Do you prefer #1?
Andy