if I understand correctly, you are trying to execute dynamic code blocks depending on the input, correct? I don't know if it will solve your case, but take a look at the strategy pattern, it resolves conditions at runtime. If you can, leave more examples here.