Extension Methods allow for the readability you expect in code you don't own. C# and Ruby have had them for a while, and I created a jar to so you can use them in java as well. (you can read the original post here)
I vBlogged my thoughts here:
Here's the simple reason you want a fluent interface for your code.
Download Extension Methods for Java
The real crux of the specific example issue you are solving here, is that infix operators are more readable and intuitive for some things than prefix operators (which are Polish notation, btw, not reverse-Polish, which is postfix). Single argument Java object methods can essentially be used as prefix operators, whereas static "utility class" methods can only be used as prefix operators.
ReplyDeleteSo what you're really doing is messing with the object model to manipulate syntax. What we have is fair amount of complexity required by the paradigm to do something that is actually quite simple.