I would solve this using a switch case:

do
switch(mapContainer.getMapConfig().getInMemoryFormat()){
   case ..
   case ...
  default: throw new RuntimeException("unknown ....
}