Skip to content

Allows to read Scaladoc at runtime by embedding as annotation by the compiler plugin.

License

Notifications You must be signed in to change notification settings

glngn/runtime-scaladoc-reader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

runtime-scaladoc-reader Build Status Maven Central License

Allows to read Scaladoc at runtime by embedding as annotation by the compiler plugin.

Setup

Add following configuration to your build.sbt:

libraryDependencies += "com.github.takezoe" %% "runtime-scaladoc-reader" % "1.0.1"

addCompilerPlugin("com.github.takezoe" %% "runtime-scaladoc-reader" % "1.0.1")

Usage

Assuming you have a below class which has Scaladoc:

package com.github.takezoe

/**
 * Hello, World!
 */
class HelloWorld {
  ...
}

You can get Scaladoc at runtime as follows:

import com.github.takezoe.HelloWorld
import com.github.takezoe.scaladoc.Scaladoc

val clazz = classOf[HelloWorld]
val scaladoc = clazz.getAnnotation(classOf[Scaladoc])

if(scaladoc != null){
  val comment: String = scaladoc.value()
  println(comment)
}

You can also get Scaladoc from Method and Field as same as Class.

About

Allows to read Scaladoc at runtime by embedding as annotation by the compiler plugin.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Scala 97.3%
  • Java 2.7%