trait
FlagSets extends AnyRef
Type Members
-
trait
FlagOps extends Any
-
-
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
def
+(other: String): String
-
def
->[B](y: B): (FlagSets, B)
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
def
ensuring(cond: (FlagSets) ⇒ Boolean, msg: ⇒ Any): FlagSets
-
def
ensuring(cond: (FlagSets) ⇒ Boolean): FlagSets
-
def
ensuring(cond: Boolean, msg: ⇒ Any): FlagSets
-
def
ensuring(cond: Boolean): FlagSets
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
finalize(): Unit
-
def
formatted(fmtstr: String): String
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
-
def
→[B](y: B): (FlagSets, B)
Inherited from Any
Inherited by implicit conversion any2stringadd from
FlagSets to any2stringadd[FlagSets]
Inherited by implicit conversion StringFormat from
FlagSets to StringFormat[FlagSets]
Inherited by implicit conversion ArrowAssoc from
FlagSets to ArrowAssoc[FlagSets]
EXPERIMENTAL
The trait that defines flag sets and operations on them.
Flag
s are used to provide modifiers for abstract syntax trees that represent definitions via theflags
field of scala.reflect.api.Trees#Modifiers. Trees that accept modifiers are:For example, to create a class named
C
one would write something like:ClassDef(Modifiers(NoFlags), newTypeName("C"), Nil, ...)
Here, the flag set is empty.
To make
C
private, one would write something like:ClassDef(Modifiers(PRIVATE), newTypeName("C"), Nil, ...)
Flags can also be combined with the vertical bar operator (
|
). For example, a private final class is written something like:ClassDef(Modifiers(PRIVATE | FINAL), newTypeName("C"), Nil, ...)
The list of all available flags is defined in scala.reflect.api.FlagSets#FlagValues, available via scala.reflect.api.FlagSets#Flag. (Typically one writes a wildcard import for this, e.g.
import scala.reflect.runtime.universe.Flag._
).Definition trees are compiled down to symbols, so flags on modifiers of these trees are transformed into flags on the resulting symbols. Unlike trees, symbols don't expose flags, but rather provide
isXXX
test methods (e.g.isFinal
can be used to test finality). These test methods might require an upcast withasTerm
,asType
orasClass
as some flags only make sense for certain kinds of symbols.Of Note: This part of the Reflection API is being considered as a candidate for redesign. It is quite possible that in future releases of the reflection API, flag sets could be replaced with something else.
For more details about
FlagSet
s and other aspects of Scala reflection, see the Reflection Guide