Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I am doing this within a Factory class' `getInstance()` method, reading the fully-qualified name of a class from a properties file and creating an instance of that class.
- ```java
- static IAuthenticationManager getInstance() throws Exception{
- if (instance == null){
- instance = new AuthenticationManagerFactory();
- }
- String type = props.getProperty(AUTH_MANAGER_TYPE);
- Class<?> c = Class.forName(type);
- return (IAuthenticationManager) c.getDeclaredMethod("getInstance").invoke(null);
- }
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement