Skip to content

Instantly share code, notes, and snippets.

@ip-imamoto
Created February 21, 2016 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ip-imamoto/b17bb17affc3fe45670e to your computer and use it in GitHub Desktop.
Save ip-imamoto/b17bb17affc3fe45670e to your computer and use it in GitHub Desktop.
アノテーションの使い方
package myannotation;
public class MyAnnotationTest {
@MyAnnotation
public String hoge; //←valueの値の指定をしていないのでデフォルト値
@MyAnnotation(value = "コンストラクタ!!!") //←値を指定
public MyAnnotationTest(String hoge) {
this.hoge = hoge;
}
@MyAnnotation("メソッド!!") //←キー名がvalueの単一値アノテーションはキー名を省略可能
public String getHoge() {
return hoge;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment