Created
November 22, 2019 16:55
-
-
Save lubarinobr/a8a4f4d9a8d521acef0499e3d6036666 to your computer and use it in GitHub Desktop.
Custom facotry
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 class Factory { | |
public getBean(Class theInterface) { | |
try { | |
Class clazz = Class.forName(theInterface.getName+"Impl"); | |
return clazz.newInstance(); | |
} catch (ReflectiveOperationException e) { | |
return null; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment