Created
July 15, 2023 08:28
-
-
Save disegmvm/48d1ac483c4c60cd5af3640f0aa4a8b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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