I don't think there really is an elegant way to do this. Your original idea looks as good as anything to me. That second code snippet looks a bit convoluted and it also would require you to create processing class instances that may not get used.