alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (TemplateComponent.scala)

This example Scala source code file (TemplateComponent.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

global, global, hello, hello, list, phase, phase, plugincomponent, plugincomponent, templatecomponent

The Scala TemplateComponent.scala source code

package plugintemplate

import scala.tools.nsc._
import scala.tools.nsc.plugins.PluginComponent

/** This class shows how to implement a compiler component that
 *  can be used in a compiler plugin. If the plugin uses a tree
 *  transformer and / or an InfoTransformer, look at the two
 *  classes <code>TemplateTransformComponent and
 *  <code>TemplateInfoTransformComponent.
 *
 *  @todo Adapt the name of this class to the plugin, and implement it.
 */
class TemplateComponent(val global: Global) extends PluginComponent {
  import global._

  val runsAfter = List[String]("refchecks")

  /** The name of this plugin phase
   *  @todo Adapt to specific plugin.
   */
  val phaseName = "plugintemplate"

  def newPhase(prev: Phase) = new Phase(prev) {
    def name = phaseName

    /** The implementation of this Phase's behavior
     *
     *  @todo Implementation.
     */
    def run {
      println("Hello from phase "+ name)
    }
  }
}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala TemplateComponent.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.