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

Scala example source code file (Visibility.scala)

This example Scala source code file (Visibility.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

boolean, boolean, privateininstance, privateintemplate, protectedininstance, protectedintemplate, protectedintemplate, public, templateentity, templateentity, visibility, visibility

The Scala Visibility.scala source code

/* NSC -- new Scala compiler
 * Copyright 2007-2011 LAMP/EPFL
 * @author  Gilles Dubochet
 */

package scala.tools.nsc
package doc
package model

/** An type that represents visibility of members. */
sealed trait Visibility {
  def isProtected: Boolean = false
  def isPublic: Boolean = false
}

/** The visibility of `private[this]` members. */
case class PrivateInInstance() extends Visibility

/** The visibility of `protected[this]` members. */
case class ProtectedInInstance() extends Visibility {
  override def isProtected = true
}

/** The visibility of `private[owner]` members. An unqualified private members
  * is encoded with `owner` equal to the members's `inTemplate`. */
case class PrivateInTemplate(owner: TemplateEntity) extends Visibility

/** The visibility of `protected[owner]` members. An unqualified protected
  * members is encoded with `owner` equal to the members's `inTemplate`.
  * Note that whilst the member is visible in any template owned by `owner`,
  * it is only visible in subclasses of the member's `inTemplate`. */
case class ProtectedInTemplate(owner: TemplateEntity) extends Visibility {
  override def isProtected = true
}

/** The visibility of public members. */
case class Public() extends Visibility {
  override def isPublic = true
}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala Visibility.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.