com.lorandszakacs.enclosure

Type members

Classlikes

final case class Enclosure(fullModuleName: String)

When generated by the macro com.lorandszakacs.enclosure.Enclosure.generateEnclosure, this class provides information about the "enclosing scope" from where it was generated.

When generated by the macro com.lorandszakacs.enclosure.Enclosure.generateEnclosure, this class provides information about the "enclosing scope" from where it was generated.

Value Params
fullModuleName

Where "module" is either a:

  • class
  • object
  • package Examples:
package myapp
import com.lorandszakacs.enclosure.
object Printer {
 def locatedPrintln(s: String)(implicit enc: Enclosure): Unit =  {
   println(s"[{enc.fullModuleName}] $$s")
 }
}
//
package myapp.module
object Main extends App {
 myapp.Printer("in main!")
 // prints out:
 // [myapp.module.Main] in main!
 nestedMethod()
 // idem
 def nestedMethod(): Unit = {
   myapp.Printer("in main!")
 }
}

if the Enclosure is generated:

  • within a nested class, that is also included in the fullModuleName.
  • within a package (object) the name will be the package name
Companion
object
object Enclosure extends EnclosureMacros
Companion
class