generator: Fix handle being passed when type is a struct

A static getter method would always generate a Handle parameter even though some types do not have a Handle like structs.