JavaTM 2 Platform
Standard Ed. 5.0

インタフェース
java.lang.annotation.Annotation の使用

Annotation を使用しているパッケージ
java.lang Java プログラム言語の設計にあたり基本的なクラスを提供します。 
java.lang.annotation Java プログラミング言語の注釈機能をサポートするライブラリを提供します。 
java.lang.reflect クラスとオブジェクトに関するリフレクト情報を取得するクラスおよびインタフェースを提供します。 
 

java.lang での Annotation の使用
 

Annotation を実装している java.lang のクラス
 interface Deprecated
          注釈付きのプログラム要素 @Deprecated は、一般に危険であったり、より適切な他のプログラム要素で代用できることもあり、プログラマには使用を勧められないプログラム要素です。
 interface Override
          メソッド宣言がスーパークラスのメソッド宣言をオーバーライドすることを示します。
 interface SuppressWarnings
          注釈を付けた要素 (および注釈を付けた要素に含まれるすべてのプログラム要素) で、名前で指定されたコンパイラ警告が抑制されることを示します。
 

Annotation 型の型パラメータを持つ java.lang のメソッド
<A extends Annotation>
A
Class.getAnnotation(Class<A> annotationClass)
          指定された型の注釈が存在する場合は、指定された型の要素の注釈を返します。
<A extends Annotation>
A
Package.getAnnotation(Class<A> annotationClass)
           
 

Annotation を返す java.lang のメソッド
 Annotation[] Class.getAnnotations()
          この要素に存在するすべての注釈を返します (この要素に注釈がない場合は長さゼロの配列を返します)。
 Annotation[] Package.getAnnotations()
           
 Annotation[] Class.getDeclaredAnnotations()
          この要素に直接存在するすべての注釈を返します。
 Annotation[] Package.getDeclaredAnnotations()
           
 

Method parameters in java.lang with type arguments of type Annotation
 boolean Class.isAnnotationPresent(Class<? extends Annotation> annotationClass)
          指定された型の注釈がこの要素に存在する場合は true を返し、そうでない場合は false を返します。
 boolean Package.isAnnotationPresent(Class<? extends Annotation> annotationClass)
           
 

java.lang.annotation での Annotation の使用
 

Annotation を実装している java.lang.annotation のクラス
 interface Documented
          型を持つ注釈が javadoc および同様のツールによってデフォルトでドキュメント化されることを示します。
 interface Inherited
          注釈型が自動的に継承されることを示します。
 interface Retention
          注釈付きの型を持つ注釈を保持する期間を示します。
 interface Target
          注釈型が適用可能なプログラム要素の種類を示します。
 

Annotation 型の引数を持つ型を返す java.lang.annotation のメソッド
 Class<? extends Annotation> Annotation.annotationType()
          この注釈の注釈型を返します。
 Class<? extends Annotation> IncompleteAnnotationException.annotationType()
          見つからない要素を持つ注釈型に対応する Class オブジェクトを返します。
 

Constructor parameters in java.lang.annotation with type arguments of type Annotation
IncompleteAnnotationException(Class<? extends Annotation> annotationType, String elementName)
          IncompleteAnnotationException を構築して、名前付き要素が指定された注釈型から見つからないことを示します。
 

java.lang.reflect での Annotation の使用
 

Annotation 型の型パラメータを持つ java.lang.reflect のメソッド
<T extends Annotation>
T
AnnotatedElement.getAnnotation(Class<T> annotationType)
          指定された型の注釈が存在する場合は、指定された型の要素の注釈を返します。
<T extends Annotation>
T
AccessibleObject.getAnnotation(Class<T> annotationClass)
           
<T extends Annotation>
T
Field.getAnnotation(Class<T> annotationClass)
           
<T extends Annotation>
T
Method.getAnnotation(Class<T> annotationClass)
           
<T extends Annotation>
T
Constructor.getAnnotation(Class<T> annotationClass)
           
 

Annotation を返す java.lang.reflect のメソッド
 Annotation[] AnnotatedElement.getAnnotations()
          この要素に存在するすべての注釈を返します (この要素に注釈がない場合は長さゼロの配列を返します)。
 Annotation[] AccessibleObject.getAnnotations()
           
 Annotation[] AnnotatedElement.getDeclaredAnnotations()
          この要素に直接存在するすべての注釈を返します。
 Annotation[] AccessibleObject.getDeclaredAnnotations()
           
 Annotation[] Field.getDeclaredAnnotations()
           
 Annotation[] Method.getDeclaredAnnotations()
           
 Annotation[] Constructor.getDeclaredAnnotations()
           
 Annotation[][] Method.getParameterAnnotations()
          この Method オブジェクトにより表されたメソッドの仮パラメータの注釈を表す配列の配列を、宣言順に返します。
 Annotation[][] Constructor.getParameterAnnotations()
          この Method オブジェクトにより表されたメソッドの仮パラメータの注釈を表す配列の配列を、宣言順に返します。
 

Method parameters in java.lang.reflect with type arguments of type Annotation
 boolean AnnotatedElement.isAnnotationPresent(Class<? extends Annotation> annotationType)
          指定された型の注釈がこの要素に存在する場合は true を返し、そうでない場合は false を返します。
 boolean AccessibleObject.isAnnotationPresent(Class<? extends Annotation> annotationClass)
           
 


JavaTM 2 Platform
Standard Ed. 5.0

バグの報告と機能のリクエスト
さらに詳しい API リファレンスおよび開発者ドキュメントについては、Java 2 SDK SE 開発者用ドキュメントを参照してください。開発者向けの詳細な解説、概念の概要、用語の定義、バグの回避策、およびコード実例が含まれています。

Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。