Hi Piyush,

Excellent remark. I fully agree and have started renaming existing "create"
methods and adding new ones to CharacterSet, Encoding, Manguage, MediaType
and Status.

The big advantage of using this static "valueOf" method instead of a
constructor is that an existing constant can be returned instance of
systematically creating a new instance. Also, the constant can have the
proper description already set (Status for example).

Best regards,
Jerome  

> -----Message d'origine-----
> De : Piyush Purang [mailto:[EMAIL PROTECTED] 
> Envoyé : lundi 18 septembre 2006 13:04
> À : [email protected]
> Objet : b18 factory methods
> 
> Hi Jerome, 
> 
> I am trying to migrate my work to b18. Eventhough I have to unlearn a 
> lot, it is much nicer to work with the API. 
> 
> I have a suggestion to make about some o.r.data classes. For Protocol 
> you provide the method - create, that acts as a factory method. It 
> would be very convenient to have a similar method for 
> ChallengeScheme. 
> 
> It would be great to be able to do 
> ChallengeScheme.valueOf("http_basic"); which we could when there was 
> the Enum ChallengeSchemes. 
> 
> that brings us to that point of consistency in naming methods names 
> etc. I propose using valueOf() just like it is used in the JDK. So 
> that means renaming the create()  to valueOf(). 
> 
> One thing that has to decided too is whether or not to ignore case in 
> such situations i.e. 
> should both http_basic and HTTP_BASIC be allowed? 
> 
> Are there any other places we could use this suggestion? 
> 
> Cheers 
> Piyush 
> 
> 

Reply via email to