aboutsummaryrefslogtreecommitdiff
path: root/stage1
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2017-02-21 20:32:58 +0800
committerChristopher Vogt <oss.nsp@cvogt.org>2017-02-22 22:50:27 +0800
commit3277f82d75fd47a951cbf91590fdc823c1281ef9 (patch)
tree3a61f0b9b5795f563bcfa5b19e9813da72a0f1a0 /stage1
parent4d8a09a10c487782487d554bab7f3829a264a9c7 (diff)
downloadcbt-3277f82d75fd47a951cbf91590fdc823c1281ef9.tar.gz
cbt-3277f82d75fd47a951cbf91590fdc823c1281ef9.tar.bz2
cbt-3277f82d75fd47a951cbf91590fdc823c1281ef9.zip
canLoad method (not used right now, but may come in handy)
Diffstat (limited to 'stage1')
-rw-r--r--stage1/cbt.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/stage1/cbt.scala b/stage1/cbt.scala
index 4caa085..8b6ebd8 100644
--- a/stage1/cbt.scala
+++ b/stage1/cbt.scala
@@ -38,6 +38,16 @@ object `package`{
case e:java.lang.UnsupportedOperationException if e.getMessage === "empty.max" => None
}
}
+ implicit class ClassLoaderExtensions(classLoader: ClassLoader){
+ def canLoad(className: String) = {
+ try{
+ classLoader.loadClass(className)
+ true
+ } catch {
+ case e: ClassNotFoundException => false
+ }
+ }
+ }
implicit class BuildInterfaceExtensions(build: BuildInterface){
import build._
// TODO: if every build has a method triggers a callback if files change