getClassForName
方法(或屬性)屬於 scala.compat.Platform
對象(object),其相關用法說明如下。
@inline @deprecated(“使用 `java.lang.Class#forName` 代替。”,因為 = "2.13.0")
用法:
def getClassForName(name: String): Class[_]
使用當前 ClassLoader
返回與具有給定字符串名稱的類或接口關聯的 Class
對象.在JVM上,調用這個方法相當於:java.lang.Class.forName(name)
有關詳細信息,請參閱 java.lang.Class 的 Java 文檔。
值參數:
- name
所需類的完全限定名稱。
返回:
具有指定名稱的類的
Class
對象.拋出:
- java.lang.ClassNotFoundException
如果找不到類
- java.lang.ExceptionInInitializerError
如果此方法引發的初始化失敗
- java.lang.LinkageError
如果鏈接失敗
例子:
val a = scala.compat.Platform.getClassForName("java.lang.Integer") // returns the Class[_] for java.lang.Integer
已棄用
[Since version 2.13.0]
源碼:
- Platform.scala
相關用法
- Scala Platform.createArray用法及代碼示例
- Scala PartialFunction.runWith用法及代碼示例
- Scala PadTo.groupMapReduce用法及代碼示例
- Scala PadTo.inits用法及代碼示例
- Scala Prepended.partitionMap用法及代碼示例
- Scala PriorityQueue.mkString用法及代碼示例
- Scala Prepended.lengthIs用法及代碼示例
- Scala Predef.nn用法及代碼示例
- Scala Predef.classOf用法及代碼示例
- Scala PriorityQueue.sliding用法及代碼示例
- Scala Prepended.groupMapReduce用法及代碼示例
- Scala Prepended.sortBy用法及代碼示例
- Scala Prepended.lengthCompare用法及代碼示例
- Scala ProcessCreation.apply用法及代碼示例
- Scala PartialFunction.elementWise用法及代碼示例
- Scala PadTo.unzip3用法及代碼示例
- Scala PriorityQueue.sizeCompare用法及代碼示例
- Scala PriorityQueue.groupBy用法及代碼示例
- Scala ProcessLogger.buffer用法及代碼示例
- Scala Predef.valueOf用法及代碼示例
- Scala PriorityQueue.tails用法及代碼示例
- Scala PadTo.mkString用法及代碼示例
- Scala Prepended.scanRight用法及代碼示例
- Scala PadTo.unzip用法及代碼示例
- Scala Prepended.combinations用法及代碼示例
注:本文由純淨天空篩選整理自scala-lang.org大神的英文原創作品 Platform.getClassForName。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。