Signature.TypeArg (Java SE 22 & JDK 22)
Description: declaration: module: java.base, package: java.lang.classfile, interface: Signature, interface: TypeArg
Keywords: java.lang.classfile.Signature.TypeArg interface

Module java.base
Package java.lang.classfilePREVIEW

# Interface Signature.TypeArg

Enclosing interface:
  `SignaturePREVIEW`

public static sealed interface Signature.TypeArg
`TypeArg` is a preview API of the Java platform.
Programs can only use `TypeArg` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models the type argument.

Since:
  22

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static enum`
  `Signature.TypeArg.WildcardIndicatorPREVIEW`
  Preview.
  Indicator for whether a wildcard has default bound, no bound, an upper bound, or a lower bound

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Optional<Signature.RefTypeSigPREVIEW>`
  `boundType()`
  Returns the signature of the type bound, if any.
  `static Signature.TypeArgPREVIEW`
  `extendsOf(Signature.RefTypeSigPREVIEW boundType)`
  Returns an upper-bounded type arg.
  `static Signature.TypeArgPREVIEW`
  `of(Signature.RefTypeSigPREVIEW boundType)`
  Returns a bounded type arg.
  `static Signature.TypeArgPREVIEW`
  `of(Signature.TypeArg.WildcardIndicatorPREVIEW wildcard, Optional<Signature.RefTypeSigPREVIEW> boundType)`
  Returns a bounded type arg.
  `static Signature.TypeArgPREVIEW`
  `superOf(Signature.RefTypeSigPREVIEW boundType)`
  Returns a lower-bounded type arg.
  `static Signature.TypeArgPREVIEW`
  `unbounded()`
  Returns an unbounded type arg.
  `Signature.TypeArg.WildcardIndicatorPREVIEW`
  `wildcardIndicator()`
  Returns the wildcard indicator.

- ## Method Details

  - ### wildcardIndicator

    Signature.TypeArg.WildcardIndicatorPREVIEW wildcardIndicator()
    Returns the wildcard indicator.
    Returns:
      the wildcard indicator

  - ### boundType

    Optional<Signature.RefTypeSigPREVIEW> boundType()
    Returns the signature of the type bound, if any.
    Returns:
      the signature of the type bound, if any

  - ### of

    static Signature.TypeArgPREVIEW of(Signature.RefTypeSigPREVIEW boundType)
    Returns a bounded type arg.
    Parameters:
      `boundType` - the bound
    Returns:
      a bounded type arg

  - ### unbounded

    static Signature.TypeArgPREVIEW unbounded()
    Returns an unbounded type arg.
    Returns:
      an unbounded type arg

  - ### extendsOf

    static Signature.TypeArgPREVIEW extendsOf(Signature.RefTypeSigPREVIEW boundType)
    Returns an upper-bounded type arg.
    Parameters:
      `boundType` - the upper bound
    Returns:
      an upper-bounded type arg

  - ### superOf

    static Signature.TypeArgPREVIEW superOf(Signature.RefTypeSigPREVIEW boundType)
    Returns a lower-bounded type arg.
    Parameters:
      `boundType` - the lower bound
    Returns:
      a lower-bounded type arg

  - ### of

    static Signature.TypeArgPREVIEW of(Signature.TypeArg.WildcardIndicatorPREVIEW wildcard, Optional<Signature.RefTypeSigPREVIEW> boundType)
    Returns a bounded type arg.
    Parameters:
      `wildcard` - the wild card
      `boundType` - optional bound type
    Returns:
      a bounded type arg