Package Summary Overview Summary

Module java.base
Package java.lang.classfilePREVIEW

# Interface MethodSignature

public sealed interface MethodSignature
`MethodSignature` is a preview API of the Java platform.
Programs can only use `MethodSignature` 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 generic signature of a method, as defined by 4.7.9.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List <SignaturePREVIEW>`
  `arguments()`
  Returns the signatures of the parameters of this method.
  `static MethodSignaturePREVIEW`
  `of (SignaturePREVIEW result, SignaturePREVIEW... arguments)`
  Returns a method signature.
  `static MethodSignaturePREVIEW`
  `of (MethodTypeDesc methodDescriptor)`
  Returns a method signature for a raw (no generic information) method descriptor.
  `static MethodSignaturePREVIEW`
  `of (List<Signature.TypeParamPREVIEW> typeParameters, List<Signature.ThrowableSigPREVIEW> exceptions, SignaturePREVIEW result, SignaturePREVIEW... arguments)`
  Returns a method signature.
  `static MethodSignaturePREVIEW`
  `parseFrom (String methodSignature)`
  Parses a raw method signature string into a MethodSignaturePREVIEW
  `SignaturePREVIEW`
  `result()`
  Returns the signatures of the return value of this method.
  `String`
  `signatureString()`
  Returns the raw signature string.
  `List <Signature.ThrowableSigPREVIEW>`
  `throwableSignatures()`
  Returns the signatures of the exceptions thrown by this method.
  `List <Signature.TypeParamPREVIEW>`
  `typeParameters()`
  Returns the type parameters of this method.

- ## Method Details

  - ### typeParameters

    List<Signature.TypeParamPREVIEW> typeParameters()
    Returns the type parameters of this method.
    Returns:
      the type parameters of this method

  - ### arguments

    List<SignaturePREVIEW> arguments()
    Returns the signatures of the parameters of this method.
    Returns:
      the signatures of the parameters of this method

  - ### result

    SignaturePREVIEW result()
    Returns the signatures of the return value of this method.
    Returns:
      the signatures of the return value of this method

  - ### throwableSignatures

    List<Signature.ThrowableSigPREVIEW> throwableSignatures()
    Returns the signatures of the exceptions thrown by this method.
    Returns:
      the signatures of the exceptions thrown by this method

  - ### signatureString

    String signatureString()
    Returns the raw signature string.
    Returns:
      the raw signature string

  - ### of

    static MethodSignaturePREVIEW of (MethodTypeDesc methodDescriptor)
    Returns a method signature for a raw (no generic information) method descriptor.
    Parameters:
      `methodDescriptor` - the method descriptor
    Returns:
      a method signature for a raw (no generic information) method descriptor

  - ### of

    static MethodSignaturePREVIEW of (SignaturePREVIEW result, SignaturePREVIEW... arguments)
    Returns a method signature.
    Parameters:
      `result` - signature for the return type
      `arguments` - signatures for the method arguments
    Returns:
      a method signature

  - ### of

    static MethodSignaturePREVIEW of (List<Signature.TypeParamPREVIEW> typeParameters, List<Signature.ThrowableSigPREVIEW> exceptions, SignaturePREVIEW result, SignaturePREVIEW... arguments)
    Returns a method signature.
    Parameters:
      `typeParameters` - signatures for the type parameters
      `exceptions` - signatures for the exceptions
      `result` - signature for the return type
      `arguments` - signatures for the method arguments
    Returns:
      a method signature

  - ### parseFrom

    static MethodSignaturePREVIEW parseFrom (String methodSignature)
    Parses a raw method signature string into a MethodSignaturePREVIEW
    Parameters:
      `methodSignature` - the raw method signature string
    Returns:
      method signature