You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2014/03/25 13:28:30 UTC

Why org.apache.logging.log4j.Level.valueOf(Class, String)?

Why do we have this API in org.apache.logging.log4j.Level:

    public static <T extends Enum<T>> T valueOf(Class<T> enumType, String
name) {
        return Enum.valueOf(enumType, name);
    }

?

-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: Why org.apache.logging.log4j.Level.valueOf(Class, String)?

Posted by Gary Gregory <ga...@gmail.com>.
Well, some Javadocs would help.

Gary


On Tue, Mar 25, 2014 at 8:31 AM, Nick Williams <
nicholas@nicholaswilliams.net> wrote:

> I'm not convinced we need it, but it was put there to make Level as close
> to a real enum as possible. Every enum provides that static method (by way
> of extending Enum).
>
> N
>
> On Mar 25, 2014, at 7:28 AM, Gary Gregory wrote:
>
> Why do we have this API in org.apache.logging.log4j.Level:
>
>     public static <T extends Enum<T>> T valueOf(Class<T> enumType, String
> name) {
>         return Enum.valueOf(enumType, name);
>     }
>
> ?
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: Why org.apache.logging.log4j.Level.valueOf(Class, String)?

Posted by Nick Williams <ni...@nicholaswilliams.net>.
I'm not convinced we need it, but it was put there to make Level as close to a real enum as possible. Every enum provides that static method (by way of extending Enum).

N

On Mar 25, 2014, at 7:28 AM, Gary Gregory wrote:

> Why do we have this API in org.apache.logging.log4j.Level:
> 
>     public static <T extends Enum<T>> T valueOf(Class<T> enumType, String name) {
>         return Enum.valueOf(enumType, name);
>     }
> 
> ?
> 
> -- 
> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory