code for pulling out the generic types from fields and return types