commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan Bilenjkij (JIRA)" <j...@apache.org>
Subject [jira] Updated: (LANG-513) Better EnumUtils
Date Tue, 07 Jul 2009 20:50:15 GMT

     [ https://issues.apache.org/jira/browse/LANG-513?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Ivan Bilenjkij updated LANG-513:
--------------------------------

    Description: 
Parametrize the getEnumMap() method with <E extends Enum<E>>.  This narrows down
the argument so that non-enums and {{null}} are rejected at compile time. Also, at its current
state the EnumUtils should never be instantiated. 

{code:title=EnumUtils.java} public static Map<String, Enum<?>> getEnumMap(Class
enumClass) {code}

changes to:

{code:title=EnumUtils.java} public static <E extends Enum<E>> Map<String, Enum<E>>
getEnumMap(Class<E> enumClass) {code}



  was:
Parametrize the getEnumMap() method with <E extends Enum<E>>.  This narrows down
the argument so that non-enums and {{null}} are rejected at compile time. Also, at it current
state the EnumUtils should never be instantiated. 

{code:title=EnumUtils.java} public static Map<String, Enum<?>> getEnumMap(Class
enumClass) {code}

changes to:

{code:title=EnumUtils.java} public static <E extends Enum<E>> Map<String, Enum<E>>
getEnumMap(Class<E> enumClass) {code}




> Better EnumUtils
> ----------------
>
>                 Key: LANG-513
>                 URL: https://issues.apache.org/jira/browse/LANG-513
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 3.0
>            Reporter: Ivan Bilenjkij
>             Fix For: 3.0
>
>         Attachments: EnumUtils.patch, EnumUtilsTest.patch
>
>
> Parametrize the getEnumMap() method with <E extends Enum<E>>.  This narrows
down the argument so that non-enums and {{null}} are rejected at compile time. Also, at its
current state the EnumUtils should never be instantiated. 
> {code:title=EnumUtils.java} public static Map<String, Enum<?>> getEnumMap(Class
enumClass) {code}
> changes to:
> {code:title=EnumUtils.java} public static <E extends Enum<E>> Map<String,
Enum<E>> getEnumMap(Class<E> enumClass) {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message