Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public synchronized <T> T get(Class<T> cls) {
- Object service = this.registry.get( cls.getName() );
- if (cls.isInstance( service )) {
- return (T) service;
- }
- try {
- return (T) Class.forName( service.getClass().getCanonicalName() ).newInstance();
- } catch (Exception e) {
- throw new RuntimeException( e );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement