bay...@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-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to