com.lorandszakacs.enclosure

Members list

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 parameters

fullModuleName

Where "module" is either a:

  • class

  • object

  • package Examples:

package myapp
import com.lorandszakacs.enclosure.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

Attributes

Companion
object
Source
Enclosure.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Enclosure extends EnclosureMacros

Attributes

Companion
class
Source
Enclosure.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Show all
Self type
Enclosure.type