commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Caswell" <ste...@caswell.name>
Subject RE: StringUtils constructor is private
Date Mon, 12 Aug 2002 19:22:30 GMT
I was under the impression that Velocity could not invoke static
methods. If this is true, then creating an instance of StringUtils would
not do any good. Hence I am -1 on putting in a public constructor since
it is generally good practice to prevent construction of an instance of
a class that has no member methods.


Steven Caswell
steven@caswell.name
a.k.a Mungo Knotwise of Michel Delving
"One ring to rule them all, one ring to find them..."


> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@adeptra.com] 
> Sent: Monday, August 12, 2002 9:15 AM
> To: Jakarta Commons Developers List
> Subject: Re: StringUtils constructor is private
> 
> 
> On 8/12/02 9:37 AM, "Jason van Zyl" <jason@zenplex.com> wrote:
> 
> > On Mon, 2002-08-12 at 01:44, Henri Yandell wrote:
> >> 
> >> I don't see many reasons why not. I should be able to easily sneak 
> >> out a replacement jar for the beta without making a song and dance 
> >> about it, it's not something that will break on anyone.
> >> 
> >> A bigger question, is why does it break things?
> > 
> > We many tools that use velocity that specify a set of tools in 
> > properties file. The tools (texen, dvsl, torque) simply instantiate 
> > objects for the toolbox based on the contents of a properties file:
> > 
> > toolbox.tool.strings = org.apache.commons.lang.StringUtils
> > 
> > Which doesn't work with a private constructor.
> > 
> >> I'm not a proponent of
> >> privatising constructors without something to protect so am the 
> >> easiest person to convince, however if there's some kind of common 
> >> tool which can only handle instance methods [and statics by 
> >> pretending they're instance] then we should modify all 
> Utils to have 
> >> constructors unless absolutely necessary.
> >> 
> >> Is it a velocity thing?
> > 
> > Well people often put utility classes into a velocity context to 
> > perform basic string, number manipulation. So in this case, 
> yes, it's 
> > a velocity thing.
> 
> In a sense it's a velocity thing, as Jason is using Velocity 
> and coming across the problem.
> 
> On the other hand, its a general thing :  I think that for 
> general utility classes that can be instantiated with an 
> argless constructor, having it public makes it easy for any 
> 'tool using' code that want to instantiate dynamically
> 
> -- 
> Geir Magnusson Jr. 
> Research & Development, Adeptra Inc.
> geirm@adeptra.com
> +1-203-247-1713
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:commons-dev-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <mailto:commons-dev-help@jakarta.apache.org>
> 
> 



--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message