Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. class ABC
  2. {
  3. //some code
  4. }
  5.  
  6. val mirror = universe.runtimeMirror(getClass.getClassLoader);
  7. val classInstance = Class.forName("ABC");
  8. val classSymbol = mirror.classSymbol(classInstance);
  9. val classType = classSymbol.toType;//println(classType) gives ABC
  10. /******this line does not work*****/
  11. classInstance.newInstance().asInstanceOf[classType];
  12. // not asInstanceOf[ABC]
  13. /***********/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement