commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <scolebou...@btopenworld.com>
Subject Re: svn commit: r775045 - in /commons/proper/lang/trunk/src: java/org/apache/commons/lang/builder/ test/org/apache/commons/lang/builder/
Date Sat, 24 Oct 2009 12:28:40 GMT
bayard@apache.org wrote:
> URL: http://svn.apache.org/viewvc?rev=775045&view=rev
> Log:
> Genericizing per LANG-336. Removed two lines in the test that were trying to build a
to string up to a class that was not in the hierarchy. The compiler now protects against this.

 >
> -public class ReflectionToStringBuilder extends ToStringBuilder {
> +public class ReflectionToStringBuilder<T> extends ToStringBuilder<T> {
 >
> -public class ToStringBuilder {
> +public class ToStringBuilder<T> {
>  

I think these gnerics are unecessary and provide insufficient benefit.

The use case for ToStringBuilder is a quick and easy way to produce a 
toString. Users shouldn't have to manually specify the class that they 
are building the toString for. Compare today vs generics:

new ToStringBuilder()
   .append(.......)
   .toString();

new ToStringBuilder<Person>()
   .append(.......)
   .toString();

The issue of blocking the input specifying an invalid super class can be 
  handled by method level generics on the static factory and 
constructor, plus a safety runtime check in setUpToClass().

Stephen


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


Mime
View raw message