Created
January 19, 2013 09:57
-
-
Save debop/4571695 to your computer and use it in GitHub Desktop.
Scala reflection을 이용한 객체 생성
This file contains hidden or 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
/** | |
* Generic 수형의 클래스에 대해 기본 생성자를 통한 인스턴스를 생성합니다. | |
*/ | |
def newInstance[T: ClassTag](): T = { | |
classTag[T].runtimeClass.newInstance().asInstanceOf[T] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment