Made DefaultedKeyFactory support all Class types

This allows generic types to be constructed without a lot of hassle with warnings and unsafe casting.

Signed-off-by: Irmo van den Berge <bergerkiller@gmail.com>