 <p><strong>I can tell you right off that bat you are approaching a simple problem with an incredibly complex solution...</strong> </p> <p>I would <em>guess</em> you are looking for the <code>instanceof</code> keyword, or perhaps an abstract validation class.</p> <p>If you could be more specific with your intended functionality we could help you come up with a reasonable design pattern.</p> <p><strong>Directly to your question:</strong> Yes, you can generate and load classes in Java on the fly. It involves invoking the <code>defineClass(String, byte[], int, int)</code> method in the reflection package. As input to this function you have to provide a byte array of the class you are instantiating. <em>This doesn't sound like the appropriate approach to this problem.</em></p>