Module java.base
Package java.lang.classfilePREVIEW

# Interface TypeAnnotation.TypePathComponent

Enclosing interface:
  `TypeAnnotationPREVIEW`

public static sealed interface TypeAnnotation.TypePathComponent
`TypePathComponent` is a preview API of the Java platform.
Programs can only use `TypePathComponent` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
JVMS: Type_path structure identifies which part of the type is annotated, as defined in 4.7.20.2

Since:
  22

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static enum`
  `TypeAnnotation.TypePathComponent.KindPREVIEW`
  Preview.
  Type path kind, as defined in 4.7.20.2

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final TypeAnnotation.TypePathComponentPREVIEW`
  `ARRAY`
  static instance for annotation is deeper in an array type
  `static final TypeAnnotation.TypePathComponentPREVIEW`
  `INNER_TYPE`
  static instance for annotation is deeper in a nested type
  `static final TypeAnnotation.TypePathComponentPREVIEW`
  `WILDCARD`
  static instance for annotation is on the bound of a wildcard type argument of a parameterized type

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static TypeAnnotation.TypePathComponentPREVIEW`
  `of(TypeAnnotation.TypePathComponent.KindPREVIEW typePathKind, int typeArgumentIndex)`
  Returns type path component of an annotation.
  `int`
  `typeArgumentIndex()`
  JVMS: type_argument_index If the value of the type_path_kind item is 0, 1, or 2, then the value of the type_argument_index item is 0.
  `TypeAnnotation.TypePathComponent.KindPREVIEW`
  `typePathKind()`
  The type path kind items from JVMS Table 4.7.20.2-A.

- ## Field Details

  - ### ARRAY

    static final TypeAnnotation.TypePathComponentPREVIEW ARRAY
    static instance for annotation is deeper in an array type

  - ### INNER_TYPE

    static final TypeAnnotation.TypePathComponentPREVIEW INNER_TYPE
    static instance for annotation is deeper in a nested type

  - ### WILDCARD

    static final TypeAnnotation.TypePathComponentPREVIEW WILDCARD
    static instance for annotation is on the bound of a wildcard type argument of a parameterized type

- ## Method Details

  - ### typePathKind

    TypeAnnotation.TypePathComponent.KindPREVIEW typePathKind()
    The type path kind items from JVMS Table 4.7.20.2-A.
    Returns:
      the kind of path element

  - ### typeArgumentIndex

    int typeArgumentIndex()
    JVMS: type_argument_index If the value of the type_path_kind item is 0, 1, or 2, then the value of the type_argument_index item is 0. If the value of the type_path_kind item is 3, then the value of the type_argument_index item specifies which type argument of a parameterized type is annotated, where 0 indicates the first type argument of a parameterized type.
    Returns:
      the index within the type component

  - ### of

    static TypeAnnotation.TypePathComponentPREVIEW of(TypeAnnotation.TypePathComponent.KindPREVIEW typePathKind, int typeArgumentIndex)
    Returns type path component of an annotation.
    Parameters:
      `typePathKind` - the kind of path element
      `typeArgumentIndex` - the type argument index
    Returns:
      type path component of an annotation