use java reflection instead of a class and formatted code