Convert String to Enum

May 18th, 2009

Last month we were coding some Groovy stuff and we needed to use Enum equivalents of couple Strings. We had couple dynamic Strings coming from off-shore developers, which defines the type of the entity. In our system, those types were represented by Enums. Anyways, basically we had to resolve the Enums from given Strings. After a little reading, we came up with following solution:

Java

3 Comments

How to Avoid NullPointerExceptions (NPE)?

May 4th, 2009

I’m sure every Java developer has had some hard times with NPEs (NullPointerException) since Java doesn’t really have a nice mechanism to avoid them :) Let’s recall something here: NPE is a run time exception and it occurs in the run time, therefore it means it is a design mistake, bad code quality or careless programming. Anyways, whatever the reason is, we all see NPEs all over our codes :) In this post, I want to cover this issue and give some tips from my experience so far.

Java

17 Comments

Understanding Static Blocks

March 15th, 2009

Before talking about Static Initializer, I wanna talk a little bit about what is this static thingy in Java.

Java

4 Comments