Skip to content

Instantly share code, notes, and snippets.

@debop
Created January 19, 2013 09:57
Scala reflection을 이용한 객체 생성
/**
* 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