-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathpackage.scala
52 lines (48 loc) · 1.57 KB
/
package.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package metascala
import collection.convert.wrapAsScala._
import reflect.ClassTag
/**
* This metascala contains the code involved in reading .class files
* (using ASM) and generating an immutable representation of all the data
* structures encoded in the class file.
*
* Almost every class in this metascala will have a read() method, which takes
* in some data structure (provided by ASM) and constructs an instance of the
* class. read() is generally called recursively to construct the members of
* each instance, until the entire instance is constructed.
*/
package object imm {
/**
* Convenience methods to provide a safe way of converting null Lists, Arrays
* or Objects into empty Lists, Arrays or None
*/
object NullSafe{
implicit class nullSafeList[T](val list: java.util.List[T]) extends AnyVal{
def safeSeq: Seq[T] = {
Option(list).toVector.flatten
}
}
implicit class nullSafeArray[T](val list: Array[T]) extends AnyVal{
def safeSeq: Seq[T] = {
Option(list).toVector.flatten
}
}
implicit class nullSafeValue[T](val a: T) extends AnyVal{
def safeOpt: Option[T] = Option(a)
}
}
object Access{
val Public = 0x0001 // 1
val Private = 0x0002 // 2
val Protected = 0x0004 // 4
val Static = 0x0008 // 8
val Final = 0x0010 // 16
val Super = 0x0020 // 32
val Volatile = 0x0040 // 64
val Transient = 0x0080 // 128
val Native = 0x0100 // 256
val Interface = 0x0200 // 512
val Abstract = 0x0400 // 1024
val Strict = 0x0800 // 2048
}
}