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

Annotationを使用しているパッケージ 
パッケージ 説明
java.beans
Bean (JavaBeans™アーキテクチャに基づいたコンポーネント)の開発に関連したクラスが含まれています。
java.lang
Javaプログラミング言語の設計にあたり基本的なクラスを提供します。
java.lang.annotation
Javaプログラミング言語の注釈機能のライブラリ・サポートを提供します。
java.lang.reflect
クラスとオブジェクトに関するリフレクト情報を取得するための、クラスとインタフェースを提供します。
javax.annotation.processing
注釈プロセッサを宣言し、注釈プロセッサが注釈処理ツール環境とやり取りできるようにするための機能。
javax.lang.model
Javaプログラミング言語をモデル化するために使用されるパッケージのクラスと階層です。
javax.lang.model.element
Javaプログラミング言語の要素をモデル化するために使用されるインタフェースです。
javax.management
Java Management Extensionsのコア・クラスを提供します。
javax.swing
すべてのプラットフォーム上で可能なかぎり同じように機能する「軽量」(Java共通言語)コンポーネントのセットを提供します。
jdk.jfr
このパッケージは、イベントを作成してFlight Recorderを制御するクラスを提供します。
  • java.beansでのAnnotationの使用

    Annotationを実装するjava.beans内のクラス 
    修飾子と型 クラス 説明
    interface  BeanProperty
    自動的に生成されたBeanInfoクラスのプロパティ関連情報を指定するために使用される注釈。
    interface  ConstructorProperties
    コンストラクタの注釈。構築されたオブジェクトのgetterメソッドにこのコンストラクタのパラメータがどのように対応するかを示します。
    interface  JavaBean
    自動生成されたBeanInfoクラスのいくつかのクラス関連情報を指定するために使用される注釈。
    interface  Transient
    Introspectorが注釈付きのコード要素に関連付けられたPropertyDescriptorまたはEventSetDescriptorクラスを構築する際に、「transient」と呼ばれる属性が指定のvalueで宣言されるべきであることを示します。
  • java.langでのAnnotationの使用

    Annotationを実装するjava.lang内のクラス 
    修飾子と型 クラス 説明
    interface  非推奨
    @Deprecatedの注釈を付けられたプログラム要素は、プログラマが使用することを薦められていないプログラム要素です。
    interface  FunctionalInterface
    インタフェース型の宣言を、Java言語仕様に定義されている関数型インタフェースとすることを目的としていることを示すために使われる情報目的の注釈型です。
    interface  Override
    メソッド宣言がスーパー・タイプのメソッド宣言をオーバーライドすることを示します。
    interface  SafeVarargs
    注釈の付いたメソッドやコンストラクタの本体が自身の可変パラメータに対して安全でない可能性のある操作を実行しないことを示す、プログラマ・アサーションです。
    interface  SuppressWarnings
    注釈を付けた要素(および注釈を付けた要素に含まれるすべてのプログラム要素)で、名前で指定されたコンパイラ警告が抑制されることを示します。
    Annotation型の型パラメータを持つjava.lang内のメソッド 
    修飾子と型 メソッド 説明
    <A extends Annotation>
    A
    Class.getAnnotation​(クラス<A> annotationClass)  
    <T extends Annotation>
    T
    Module.getAnnotation​(クラス<T> annotationClass)
    存在する場合は、この要素の指定された型の注釈を返し、そうでない場合はnullを返します。
    <A extends Annotation>
    A
    Package.getAnnotation​(クラス<A> annotationClass)  
    <A extends Annotation>
    A[]
    Class.getAnnotationsByType​(クラス<A> annotationClass)  
    <A extends Annotation>
    A[]
    Package.getAnnotationsByType​(クラス<A> annotationClass)  
    <A extends Annotation>
    A
    Class.getDeclaredAnnotation​(クラス<A> annotationClass)  
    <A extends Annotation>
    A
    Package.getDeclaredAnnotation​(クラス<A> annotationClass)  
    <A extends Annotation>
    A[]
    Class.getDeclaredAnnotationsByType​(クラス<A> annotationClass)  
    <A extends Annotation>
    A[]
    Package.getDeclaredAnnotationsByType​(クラス<A> annotationClass)  
    Annotationを返すjava.lang内のメソッド 
    修飾子と型 メソッド 説明
    Annotation[] Class.getAnnotations()  
    Annotation[] Module.getAnnotations()
    この要素に存在する注釈を返します。
    Annotation[] Package.getAnnotations()  
    <A extends Annotation>
    A[]
    Class.getAnnotationsByType​(クラス<A> annotationClass)  
    <A extends Annotation>
    A[]
    Package.getAnnotationsByType​(クラス<A> annotationClass)  
    Annotation[] Class.getDeclaredAnnotations()  
    Annotation[] Module.getDeclaredAnnotations()
    この要素に直接存在する注釈を返します。
    Annotation[] Package.getDeclaredAnnotations()  
    <A extends Annotation>
    A[]
    Class.getDeclaredAnnotationsByType​(クラス<A> annotationClass)  
    <A extends Annotation>
    A[]
    Package.getDeclaredAnnotationsByType​(クラス<A> annotationClass)  
    Annotation型の型引数を持つjava.lang内のメソッド・パラメータ 
    修飾子と型 メソッド 説明
    boolean Class.isAnnotationPresent​(Class<? extends Annotation> annotationClass)
    指定された型の注釈がこの要素に存在する場合はtrueを返し、そうでない場合はfalseを返します。
    boolean Package.isAnnotationPresent​(Class<? extends Annotation> annotationClass)
    指定された型の注釈がこの要素に存在する場合はtrueを返し、そうでない場合はfalseを返します。
  • java.lang.annotationでのAnnotationの使用

    Annotationを実装するjava.lang.annotation内のクラス 
    修飾子と型 クラス 説明
    interface  Documented
    注釈@Documentedが注釈型Aの宣言に存在する場合、要素の@A注釈は要素公的契約の一部とみなされます。
    interface  Inherited
    注釈型が自動的に継承されることを示します。
    interface  Native
    定数値を定義するフィールドがネイティブ・コードから参照される可能性があることを示します。
    interface  Repeatable
    注釈型java.lang.annotation.Repeatableは、宣言に(メタ)注釈を付ける注釈型が繰返し可能であることを示すために使用されます。
    interface  Retention
    注釈付きの型を持つ注釈を保持する期間を示します。
    interface  Target
    注釈型が適用可能なコンテキストを示します。
    Annotation型の引数を持つ型を返すjava.lang.annotation内のメソッド 
    修飾子と型 メソッド 説明
    Class<? extends Annotation> Annotation.annotationType()
    この注釈の注釈型を返します。
    Class<? extends Annotation> IncompleteAnnotationException.annotationType()
    見つからない要素を持つ注釈型に対応するClassオブジェクトを返します。
    Class<? extends Annotation> value()
    繰返し可能な注釈型用の包含する注釈型を示します。
    Annotation型の型引数を持つjava.lang.annotation内のコンストラクタ・パラメータ 
    コンストラクタ 説明
    IncompleteAnnotationException​(Class<? extends Annotation> annotationType, String elementName)
    IncompleteAnnotationExceptionを構築して、名前付き要素が指定された注釈型から見つからないことを示します。
  • java.lang.reflectでのAnnotationの使用

    Annotation型の型パラメータを持つjava.lang.reflect内のメソッド 
    修飾子と型 メソッド 説明
    <T extends Annotation>
    T
    AccessibleObject.getAnnotation​(クラス<T> annotationClass)  
    <T extends Annotation>
    T
    AnnotatedElement.getAnnotation​(クラス<T> annotationClass)
    存在する場合は、この要素の指定された型の注釈を返し、そうでない場合はnullを返します。
    <T extends Annotation>
    T
    Constructor.getAnnotation​(クラス<T> annotationClass)
    存在する場合は、この要素の指定された型の注釈を返し、そうでない場合はnullを返します。
    <T extends Annotation>
    T
    Executable.getAnnotation​(クラス<T> annotationClass)
    存在する場合は、この要素の指定された型の注釈を返し、そうでない場合はnullを返します。
    <T extends Annotation>
    T
    Field.getAnnotation​(クラス<T> annotationClass)  
    <T extends Annotation>
    T
    Method.getAnnotation​(クラス<T> annotationClass)
    存在する場合は、この要素の指定された型の注釈を返し、そうでない場合はnullを返します。
    <T extends Annotation>
    T
    Parameter.getAnnotation​(クラス<T> annotationClass)
    存在する場合は、この要素の指定された型の注釈を返し、そうでない場合はnullを返します。
    <T extends Annotation>
    T[]
    AccessibleObject.getAnnotationsByType​(クラス<T> annotationClass)  
    default <T extends Annotation>
    T[]
    AnnotatedElement.getAnnotationsByType​(クラス<T> annotationClass)
    この要素に関連付けられている注釈を返します。
    <T extends Annotation>
    T[]
    Executable.getAnnotationsByType​(クラス<T> annotationClass)
    この要素に関連付けられている注釈を返します。
    <T extends Annotation>
    T[]
    Field.getAnnotationsByType​(クラス<T> annotationClass)
    この要素に関連付けられている注釈を返します。
    <T extends Annotation>
    T[]
    Parameter.getAnnotationsByType​(クラス<T> annotationClass)
    この要素に関連付けられている注釈を返します。
    <T extends Annotation>
    T
    AccessibleObject.getDeclaredAnnotation​(クラス<T> annotationClass)  
    default <T extends Annotation>
    T
    AnnotatedElement.getDeclaredAnnotation​(クラス<T> annotationClass)
    直接存在する場合は、この要素の指定された型の注釈を返し、そうでない場合はnullを返します。
    <T extends Annotation>
    T
    Parameter.getDeclaredAnnotation​(クラス<T> annotationClass)  
    <T extends Annotation>
    T[]
    AccessibleObject.getDeclaredAnnotationsByType​(クラス<T> annotationClass)  
    default <T extends Annotation>
    T[]
    AnnotatedElement.getDeclaredAnnotationsByType​(クラス<T> annotationClass)
    直接存在する間接的に存在する場合は、この要素の指定された型の注釈を返します。
    <T extends Annotation>
    T[]
    Parameter.getDeclaredAnnotationsByType​(クラス<T> annotationClass)  
    Annotationを返すjava.lang.reflect内のメソッド 
    修飾子と型 メソッド 説明
    Annotation[] AccessibleObject.getAnnotations()  
    Annotation[] AnnotatedElement.getAnnotations()
    この要素に存在する注釈を返します。
    <T extends Annotation>
    T[]
    AccessibleObject.getAnnotationsByType​(クラス<T> annotationClass)  
    default <T extends Annotation>
    T[]
    AnnotatedElement.getAnnotationsByType​(クラス<T> annotationClass)
    この要素に関連付けられている注釈を返します。
    <T extends Annotation>
    T[]
    Executable.getAnnotationsByType​(クラス<T> annotationClass)
    この要素に関連付けられている注釈を返します。
    <T extends Annotation>
    T[]
    Field.getAnnotationsByType​(クラス<T> annotationClass)
    この要素に関連付けられている注釈を返します。
    <T extends Annotation>
    T[]
    Parameter.getAnnotationsByType​(クラス<T> annotationClass)
    この要素に関連付けられている注釈を返します。
    Annotation[] AccessibleObject.getDeclaredAnnotations()  
    Annotation[] AnnotatedElement.getDeclaredAnnotations()
    この要素に直接存在する注釈を返します。
    Annotation[] Constructor.getDeclaredAnnotations()
    この要素に直接存在する注釈を返します。
    Annotation[] Method.getDeclaredAnnotations()
    この要素に直接存在する注釈を返します。
    <T extends Annotation>
    T[]
    AccessibleObject.getDeclaredAnnotationsByType​(クラス<T> annotationClass)  
    default <T extends Annotation>
    T[]
    AnnotatedElement.getDeclaredAnnotationsByType​(クラス<T> annotationClass)
    直接存在する間接的に存在する場合は、この要素の指定された型の注釈を返します。
    <T extends Annotation>
    T[]
    Parameter.getDeclaredAnnotationsByType​(クラス<T> annotationClass)  
    Annotation[][] Constructor.getParameterAnnotations()
    このオブジェクトによって表されるExecutableの仮パラメータの注釈を表すAnnotationの配列の配列を、宣言順に返します。
    abstract Annotation[][] Executable.getParameterAnnotations()
    このオブジェクトによって表されるExecutableの仮パラメータの注釈を表すAnnotationの配列の配列を、宣言順に返します。
    Annotation[][] Method.getParameterAnnotations()
    このオブジェクトによって表されるExecutableの仮パラメータの注釈を表すAnnotationの配列の配列を、宣言順に返します。
    Annotation型の型引数を持つjava.lang.reflect内のメソッド・パラメータ 
    修飾子と型 メソッド 説明
    boolean AccessibleObject.isAnnotationPresent​(Class<? extends Annotation> annotationClass)
    指定された型の注釈がこの要素に存在する場合はtrueを返し、そうでない場合はfalseを返します。
    default boolean AnnotatedElement.isAnnotationPresent​(Class<? extends Annotation> annotationClass)
    指定された型の注釈がこの要素に存在する場合はtrueを返し、そうでない場合はfalseを返します。
  • javax.annotation.processingでのAnnotationの使用

    Annotationを実装するjavax.annotation.processing内のクラス 
    修飾子と型 クラス 説明
    interface  Generated
    Generated注釈は、生成されたソース・コードにマークを付けるために使用されます。
    interface  SupportedAnnotationTypes
    ある注釈プロセッサがサポートする注釈型を示すのに使用される注釈。
    interface  SupportedOptions
    ある注釈プロセッサがサポートするオプションを示すのに使用される注釈。
    interface  SupportedSourceVersion
    ある注釈プロセッサがサポートする最新ソース・バージョンを示すのに使用される注釈。
    Annotation型の型引数を持つjavax.annotation.processing内のメソッド・パラメータ 
    修飾子と型 メソッド 説明
    Set<? extends Element> RoundEnvironment.getElementsAnnotatedWith​(Class<? extends Annotation> a)
    指定された注釈型を使って注釈を付けられた要素を返します。
    default Set<? extends Element> RoundEnvironment.getElementsAnnotatedWithAny​(Set<Class<? extends Annotation>> annotations)
    指定された注釈型の1つ以上で注釈が付けられた要素を返します。
  • javax.lang.modelでのAnnotationの使用

    Annotation型の型パラメータを持つjavax.lang.model内のメソッド 
    修飾子と型 メソッド 説明
    <A extends Annotation>
    A
    AnnotatedConstruct.getAnnotation​(クラス<A> annotationType)
    存在する場合は、この構造の指定された型の注釈を返し、そうでない場合はnullを返します。
    <A extends Annotation>
    A[]
    AnnotatedConstruct.getAnnotationsByType​(クラス<A> annotationType)
    この構造に関連付けられている注釈を返します。
    Annotationを返すjavax.lang.model内のメソッド 
    修飾子と型 メソッド 説明
    <A extends Annotation>
    A[]
    AnnotatedConstruct.getAnnotationsByType​(クラス<A> annotationType)
    この構造に関連付けられている注釈を返します。
  • javax.lang.model.elementでのAnnotationの使用

    Annotation型の型パラメータを持つjavax.lang.model.element内のメソッド 
    修飾子と型 メソッド 説明
    <A extends Annotation>
    A
    Element.getAnnotation​(クラス<A> annotationType)
    存在する場合は、この構造の指定された型の注釈を返し、そうでない場合はnullを返します。
  • javax.managementでのAnnotationの使用

    Annotationを実装するjavax.management内のクラス 
    修飾子と型 クラス 説明
    interface  ConstructorParameters
    コンストラクタの注釈。構築されたオブジェクトのgetterメソッドにこのコンストラクタのパラメータがどのように対応するかを示します。
    interface  DescriptorKey
    注釈要素とDescriptor内のフィールドとの関係を記述するメタ注釈です。
    interface  MXBean
    インタフェースに対して、MXBeanインタフェースである、またはMXBeanインタフェースではないというマークを明示的に付けるための注釈です。
  • javax.swingでのAnnotationの使用

    Annotationを実装しているjavax.swingのクラス
    修飾子と型 クラス 説明
    interface  SwingContainer
    自動的に生成されたBeanInfoクラスのswing関連情報を指定するために使用される注釈。
  • jdk.jfrでのAnnotationの使用

    Annotationを実装しているjdk.jfrのクラス
    修飾子と型 クラス 説明
    interface  BooleanFlag
    イベント・フィールド注釈で、値がブール・フラグ、trueまたはfalseの値であることを指定します
    interface  Category
    イベント・タイプをカテゴリに関連付けるイベント注釈(判読可能なパス形式)。
    interface  ContentType
    メタ注釈は、注釈がコンテンツ・タイプ(タイム・スパン、頻度など)を表すことを示します。
    interface  DataAmount
    イベント・フィールド注釈で、値がデータ(たとえば、バイト)の量を表すことを指定します。
    interface  Description
    文または2つを使用して要素を記述する注釈。
    interface  Enabled
    イベント注釈は、デフォルトでイベントを有効にするかどうかを決定します。
    interface  Experimental
    要素が試験的なものであり、予告なしに変更される可能性があることを指定する注釈。
    interface  Frequency
    イベント・フィールド注釈で、値がHzで測定される頻度であることを指定します。
    interface  Label
    要素(たとえば、"Maximum Throughput")に判読可能な名前を設定する注釈。
    interface  MemoryAddress
    イベント・フィールド注釈は、値がメモリー・アドレスであることを示します。
    interface  MetadataDefinition
    新しいタイプのイベント・メタデータを定義するためのメタ注釈。
    interface  Name
    要素(たとえば、イベントのデフォルト・パッケージが適切でない場合などです。)のデフォルト名をオーバーライドする注釈。
    interface  Percentage
    分数(通常は0.01.0の間)で使用するイベント・フィールド注釈で、値がパーセントであることを指定します。
    interface  Period
    イベント注釈で、定期イベントのデフォルト設定値を指定します。
    interface  Registered
    プログラムによるイベント登録のためのイベント注釈。
    interface  Relational
    注釈で使用される、リレーショナル注釈のメタ注釈。
    interface  SettingDefinition
    イベント・クラスのメソッドをイベントの除外に使用する必要があることを指定する注釈。
    interface  StackTrace
    イベント注釈。デフォルトでイベントにスタック・トレースがあるかどうかを判別します。
    interface  Threshold
    イベント注釈で、イベントが(たとえば、"20 ms")に記録されないデフォルト期間を指定します。
    interface  Timespan
    イベント・フィールド注釈は、値が期間であることを指定します。
    interface  Timestamp
    イベント・フィールド注釈は、値が特定の時点であることを示します。
    interface  TransitionFrom
    イベント・フィールド注釈で、イベントがスレッドから遷移することを指定します。
    interface  TransitionTo
    イベント・フィールド注釈では、イベントがスレッドにすぐに遷移することを指定します。
    interface  Unsigned
    イベント・フィールド注釈は、値が符号なしデータ型であることを示します。
    Annotationの型パラメータを持つjdk.jfrのメソッド
    修飾子と型 メソッド 説明
    <A extends Annotation>
    A
    EventType.getAnnotation​(クラス<A> annotationClass)
    同じ名前の注釈要素が直接存在する場合は、指定された型の最初の注釈を返します。そうでない場合はnullを返します。
    <A extends Annotation>
    A
    SettingDescriptor.getAnnotation​(クラス<A> annotationType)
    同じ名前の注釈要素が使用可能な場合は、指定された型の最初の注釈を返します。それ以外の場合はnullを返します。
    <A extends Annotation>
    A
    ValueDescriptor.getAnnotation​(クラス<A> annotationType)
    この値記述子(null)に同じ名前の注釈要素が直接存在する場合は、指定された型の最初の注釈を返します。
    Annotationの型引数を持つjdk.jfrのメソッド・パラメータ
    修飾子と型 メソッド 説明
    <A> A AnnotationElement.getAnnotation​(Class<? extends Annotation> annotationType)
    同じ名前のAnnotationElementが存在する場合は、指定された型の最初の注釈を戻し、それ以外の場合はnullを戻します。
    Annotationの型引数を持つjdk.jfrのコンストラクタ・パラメータ
    コンストラクタ 説明
    AnnotationElement​(Class<? extends Annotation> annotationType)
    動的に定義されるイベントに使用する注釈要素を作成します。
    AnnotationElement​(Class<? extends Annotation> annotationType, Object value)
    動的に定義されるイベントに使用する注釈要素を作成します。
    AnnotationElement​(Class<? extends Annotation> annotationType, Map<String,​Object> values)
    動的に定義されるイベントに使用する注釈要素を作成します。