Use java 7 and use a switch for element factory