You're right, I can access the class of the field this way. I've been able to do something like that (see my new commit).

Thanks !