[
https://issues.apache.org/jira/browse/LANG-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14539731#comment-14539731
]
Cimballi edited comment on LANG-1136 at 5/12/15 12:16 PM:
----------------------------------------------------------
Your example is with days, there could a lot of other examples or situations
where such a method is useful.
Right now I am using my own method but I already faced the case a few times and
so I thought it could be useful to add it to a library like commons-lang.
Now I let you decide if it's worth adding it or not...
Do not forget there is also the handling of null values.
Also your example suppose you can update the enum. If you can't update the
enums, you need an util method.
was (Author: cimballi):
Your example is with days, there could a lot of other examples or situations
where such a method is useful.
Right now I am using my own method but I already faced the case a few times and
so I thought it could be useful to add it to a library like commons-lang.
Now I let you decide if it's worth adding it or not...
Do not forget there is also the handling of null values.
> Add a method in EnumUtils to 'translate' an enum value
> ------------------------------------------------------
>
> Key: LANG-1136
> URL: https://issues.apache.org/jira/browse/LANG-1136
> Project: Commons Lang
> Issue Type: Wish
> Reporter: Cimballi
> Priority: Minor
> Fix For: Discussion
>
>
> Add a method in EnumUtils to 'translate' an enum value.
> Example :
> Enum1
> Enum2
> Object.enum2
> Enum1 getEnum(Enum1.class, Object.enum2);
> If enum2 is null, returns 2, else returns the Enum1 with the same name as
> Object.enum2, throws exception if no such Enum1.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)