Posts on ‘August 31st, 2007’

Using Java Enums

This week I discovered two useful things you can do with Enums in Java. The first and probably the more useful of the two is for formatting error messages in a consise and type safe way. public enum ErrorMessageKey {   FILE_NOT_FOUND( "Cannot find file {0}"),   CANNOT_READ_FILE( "Cannot read file {0}"),   FILESTORE_CANNOT_OPEN_FILE( "Unable [...]