Changed the HAL factories to work with JAVA generics