Skip to content

Instantly share code, notes, and snippets.

@disegmvm
Created July 15, 2023 08:28
Show Gist options
  • Save disegmvm/48d1ac483c4c60cd5af3640f0aa4a8b0 to your computer and use it in GitHub Desktop.
Save disegmvm/48d1ac483c4c60cd5af3640f0aa4a8b0 to your computer and use it in GitHub Desktop.
public interface TestObject {
void performTest();
}
public class TestObjectFactory {
public static TestObject createTestObject(String type) {
if (type.equals("TypeA")) {
return new TestObjectA();
} else if (type.equals("TypeB")) {
return new TestObjectB();
}
// Handle other types or default case
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment