@符号在scala中的变量之前意味着什么?

edd*_*ark 1 scala playframework-2.0

在一些文档中,我@在变量之前遇到了符号.这个符号是什么意思?

以下是文档中的代码:

class Book(val id: Long, 
           var title: String,
           @Column("AUTHOR_ID")
           var authorId: Long,
           var coAuthorId: Option[Long]) {

  def this() = this(0,"",0,Some(0L))
}
Run Code Online (Sandbox Code Playgroud)

Jus*_*ony 7

这意味着它是一个annotation.在此特定方案中,如果查看文档,它实际上是注释的别名.

键入Column = org.squeryl.annotations.ColumnBase @ scala.annotation.meta.field

ColumnBase使用带有ClassfileAnnotation的Annotation扩展Annotation