[threeten-dev] Review for Remove [Temporal/Chrono][Field/Unit].getName #314
roger riggs
roger.riggs at oracle.com
Tue May 28 11:10:28 PDT 2013
Hi,
The function of toString and the values as the readable name of a
field/value
have not changed. ChronoUnit and ChronoField are Enums with field names
that are upper case but the toString value is camel case and always was
the case
for the getName and toString methods.
The name() method inherited from Enum provides the enumeration name
(upper case)
and that has not changed.
Unless I misunderstand the comment, the current implementation is
easier to use and understand.
Roger
On 5/25/2013 6:47 PM, Stephen Colebourne wrote:
> I would say that the toString in TemporalUnit and TemporalField are
> now not quite right because the majority of the implementations use
> upper case, but the examples in the javadoc do not show that. We
> should recommend the use of upper case with underscores there (and
> ensure subclasses are consistent).
>
> The rest of the change looks good.
>
> Stephen
>
>
> On 24 May 2013 21:08, roger riggs <roger.riggs at oracle.com> wrote:
>> Hi,
>>
>> The issue #314 <https://github.com/ThreeTen/threeten/issues/314> was raised
>> to address the overlap between name and getName
>> methods in ChronoUnit. The proposal is to remove the getName method
>> and use toString() when the readable name of a field or unit is needed.
>>
>> The bulk of the classes in the review are replacing explicit calls to
>> getName
>> with the corresponding or implicit call to toString().
>>
>> http://cr.openjdk.java.net/~rriggs/webrev-getname-314/
>>
>> Please review and comment.
>>
>> Roger
>>
More information about the threeten-dev
mailing list