Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 26653 invoked from network); 12 Aug 2002 22:29:41 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 12 Aug 2002 22:29:41 -0000 Received: (qmail 25341 invoked by uid 97); 12 Aug 2002 22:29:57 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 25247 invoked by uid 97); 12 Aug 2002 22:29:54 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 25040 invoked by uid 98); 12 Aug 2002 22:29:50 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) X-Qmail-Scanner-Mail-From: baliuka@centras.lt via jim.skynet.vl X-Qmail-Scanner: 1.03 (Clean. Processed in 1.649259 secs) Message-ID: <008901c2424f$9e18a4e0$0111010a@user> From: "Juozas Baliuka" To: "Jakarta Commons Developers List" Cc: References: <20020812151211.G42157-100000@icarus.apache.org> Subject: Re: StringUtils constructor is private Date: Tue, 13 Aug 2002 00:28:44 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi, we can add "ReflectUtils" to instantiate objects with private contructor, something like this : Object newInstance(Class clasz){ try{ Constructor constructor = clasz.getDeclaredConstructor( new Class[] {}); constructor.setAccessible(true); return constructor.newInstance( new Object[]{}); .............................................................. ----- Original Message ----- From: "Craig R. McClanahan" To: "Jakarta Commons Developers List" Cc: Sent: Tuesday, August 13, 2002 12:15 AM Subject: Re: StringUtils constructor is private > > > On 12 Aug 2002, Daniel Rall wrote: > > > Date: 12 Aug 2002 14:30:59 -0700 > > From: Daniel Rall > > Reply-To: Jakarta Commons Developers List > > To: Jakarta Commons Developers List > > Cc: steven@caswell.name > > Subject: Re: StringUtils constructor is private > > > > "Steven Caswell" writes: > > > > > 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. > > > > Velocity will invoke static methods on an instance, just as Java will. > > > > But Velocity apparently *requires* an instance in order to do this, > whereas Java doesn't. > > Call it a restriction instead of a flaw if you want; it's a requirement > imposed by Velocity on classes whose static methods it wants to access. > > Craig > > > > > -- > > To unsubscribe, e-mail: > > For additional commands, e-mail: > > > > > > > -- > To unsubscribe, e-mail: > For additional commands, e-mail: > -- To unsubscribe, e-mail: For additional commands, e-mail: