Programming is hard by Stephan Schmidt

cintoo Messages moved to Java 5

I moved cintoo Messages to JDK 1.5 because of several reasons. I know this will reduce the potential user base, but with Mustang on the horizon, a lot of projects are moving to 1.5 now or in the near feature. Beside I really like generics (being a strong opposer for some years, though IDEA could make code less noisy and hide generics completely) and Java 5 has varargs and outoboxing. This makes dealing with String formatting much easier.

Instead of:

format(”{0} of {1} files removed”,
new Integer[] { new Integer(3), new Integer(7) });

(there was a helper in Messages which took int[] )

now you can write

format(”{0} of {1} files removed”, 3, 7);

which is mapped to

public String format(String text, Object… args);

The Object… is syntactic sugar and is automatically mapped from “3, 7″ to Object[] with
autoboxing 3 and 7 to objects.

If you liked this post, subscribe to my free full RSS feed.
Filed under: Java, Software development

You can share this post!
Do you want to tell others about this article? Use the social bookmark icons to submit this artice to the service of your choice. Thanks.

Get free updates by email

If you did like this article you can get free updates with your RSS reader, you can follow me on Twitter or get free update to new posts by email. Enter your email:

 
About the author: Stephan has been working as a head of development and CTO. He has experiences in different technologies since 20 years including Java, Rails and Python. Stephans main field of interest is maintainablity and productivity in software development. Want to know more? All views are only his own.

Leave a Reply