Skip to content

Commit

Permalink
docs: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tkqubo committed Dec 2, 2015
1 parent 2ef5696 commit a1b0e5a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
27 changes: 24 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
# Scala Type-Safe Annotation Plugin
[![License: MIT](http://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Circle CI](https://circleci.com/gh/tkqubo/scala-typed-annotation-plugin.svg?style=svg)](https://circleci.com/gh/tkqubo/scala-typed-annotation-plugin)
[![Test Coverage](https://codeclimate.com/github/tkqubo/scala-typed-annotation-plugin/badges/coverage.svg)](https://codeclimate.com/github/tkqubo/scala-typed-annotation-plugin/coverage)
[![Issue Count](https://codeclimate.com/github/tkqubo/scala-typed-annotation-plugin/badges/issue_count.svg)](https://codeclimate.com/github/tkqubo/scala-typed-annotation-plugin)
[![Circle CI](https://img.shields.io/circleci/project/tkqubo/scala-typed-annotation-plugin/master.svg)](https://circleci.com/gh/tkqubo/scala-typed-annotation-plugin)
[![Coverage Status](https://coveralls.io/repos/tkqubo/scala-typed-annotation-plugin/badge.svg?branch=master&service=github)](https://coveralls.io/github/tkqubo/scala-typed-annotation-plugin?branch=master)

Your annotations now become type-safe

# Usage

1. Annotate your annotation with `TypedAnnotation`, providing the type you want to endorse on the target annotation.

```
@TypedAnnotation(classOf[Long])
class max(val value: Long) extends StaticAnnotation
```

2. Then you can get the compilation error when you put that annotation on a member variable with a wrong type

```scala
object Test {
@max(255)
var value: String = null // compilation error, because Long and String doesn't match
}
```

3. That's it!


Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ object TypedAnnotationPluginTest {
@childNamed("child")
var child: Child = null
}

0 comments on commit a1b0e5a

Please sign in to comment.