converting java to groovy