commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack, Paul" <pj...@sfaf.org>
Subject RE: XxxUtils constructors
Date Mon, 19 Aug 2002 16:42:44 GMT
Thanks for the suggestion, but Velocity and other bean-based tools require
public,
no-argument constructors to create instances. Velocity (and probably many
other
tools) don't know how to reference a static field to fetch an instance.

But I at least appreciate the attempt at compromise. :)

-Paul

> -----Original Message-----
> From: Tomasz Pik [mailto:pikus@ais.pl]
> Sent: Sunday, August 18, 2002 9:36 PM
> To: commons-dev@jakarta.apache.org
> Subject: XxxUtils constructors
> 
> 
> (maybe this idea has been discussed yes, if yes, I'm sorry for
> this email).
> 
> Why the XxxUtils classes cannot use singleton pattern, something like:
> 
> public class XUtils {
> 
>    private static XUtils _singleton = new XUtils();
> 
>    private XUtils() {
>      ;
>    }
> 
>    public static XUtils singleton() {
>      return _singleton;
>    }
> 
>    public static boolean doUtilityFunction() {
>      return true;
>    }
> }
> 
> They'll have private constructors but people may use them inside
> Velocity (as context.put("XUtils", XUtils.singleton();).
> 
> Regards
> Tomek Pik
> pikus@ais.pl
> 
> 
> --
> 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