Ah! I should have read this post before answering the previous!

That is even BETTER! 
=:o)

It is simpler and not creating a class makes all the sense for
something not used very often.


Have fun,
Paulo Gaspar


http://www.krankikom.de
http://www.ruhronline.de
 

> -----Original Message-----
> From: Peter Donald [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 11, 2002 5:36 AM
> To: Avalon Developers List
> Subject: Re: Divergence from Avalon (was Re: [RT] Is Poolable Harmful?)
> 
> 
> On Fri, 11 Jan 2002 09:56, Peter Donald wrote:
> > On Fri, 11 Jan 2002 01:51, Paulo Gaspar wrote:
> > > Wouldn't an adapter class for such especial cases be adequate?
> > > Something like (just a draft):
> >
> > Similar to what I did. Except mine looked like
> >
> > > public class LogLevel extends ValuedEnum
> > >     implements Serializable
> > > {
> > >     private final static Map m_levelMap = new HashMap(5);
> > >
> > >     public final static LogLevel DEBUG       = new 
> LogLevel("DEBUG",  5);
> > >     public final static LogLevel INFO        = new 
> LogLevel("INFO",  10);
> > >     public final static LogLevel WARN        = new 
> LogLevel("WARN",  15);
> > >     public final static LogLevel ERROR       = new 
> LogLevel("ERROR", 20);
> > >     public final static LogLevel FATAL_ERROR = new
> > > LogLevel("FATAL_ERROR", 25);
> >
> >       public static void log( final String message, LogLevel level )
> >       {
> >        ...do if statement here...
> >       }
> 
> of course I meant to pass in a Logger to here:)
> 
> 
> >
> > >     private LogLevel(final String i_name, final int i_value)
> > >     {
> > >         super(i_name, i_value, m_levelMap);
> > >     }
> > >
> > >     public static LogLevel getLevelForName(final String i_levelName)
> > >     {
> > >         return (LogLevel)m_levelMap.get(i_levelName.toUpperCase());
> > >     }
> > >
> > >     public String toString()
> > >     {
> > >         return "LogLevel[" + getName() + "/" + getValue() + "]";
> > >     }
> > >
> > >     private Object readResolve()
> > >         throws ObjectStreamException
> > >     {
> > >         return getLevelForName(getName());
> > >     }
> > > }
> > >
> > > This would allow to keep the current "clean" interface and
> > > use this class just for those especial cases.
> > >
> > > What do you think?
> >
> > Either way is good ;)
> 
> -- 
> Cheers,
> 
> Pete
> 
> ------------------------------------------------------------
>  militant agnostic: i don't know, and you don't know either.
> ------------------------------------------------------------
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to