commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Rall <...@finemaltcoding.com>
Subject Re: StringUtils constructor is private
Date Mon, 12 Aug 2002 23:19:58 GMT
"Juozas Baliuka" <baliuka@centras.lt> writes:

> Object newInstance(Class clasz){
>  try{
>        Constructor constructor = clasz.getDeclaredConstructor( new Class[]
> {});
>        constructor.setAccessible(true);
>        return constructor.newInstance( new Object[]{});

No offense intended, but seeing private ctors used like that makes me
wince.  Does anyone have a serious problem with providing a protected
ctor?  There is clearly a valid use case for introspection, and though
we don't want to promote this as the suggested mode of operation, is
there really enough value in explicitly dis-allowing it (by preventing
sub-classing)?
-- 

Daniel Rall <dlr@finemaltcoding.com>

--
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