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

Module java.base
Package java.lang.classfile.attributePREVIEW

# Interface MethodParameterInfo

public sealed interface MethodParameterInfo
`MethodParameterInfo` is a preview API of the Java platform.
Programs can only use `MethodParameterInfo` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models a single method parameter in the `MethodParametersAttribute`PREVIEW.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default Set<AccessFlag>`
  `flags()`
  Parameter access flags for this parameter.
  `int`
  `flagsMask()`
  Parameter access flags for this parameter, as a bit mask.
  `default boolean`
  `has(AccessFlag flag)`
  Returns whether the method parameter has a specific flag set.
  `Optional<Utf8EntryPREVIEW>`
  `name()`
  The name of the method parameter, if there is one.
  `static MethodParameterInfoPREVIEW`
  `of(Optional<Utf8EntryPREVIEW> name, int flags)`
  Returns a method parameter description.
  `static MethodParameterInfoPREVIEW`
  `of(Optional<String> name, AccessFlag... flags)`
  Returns a method parameter description.
  `static MethodParameterInfoPREVIEW`
  `ofParameter(Optional<String> name, int flags)`
  Returns a method parameter description.

- ## Method Details

  - ### name

    Optional<Utf8EntryPREVIEW> name()
    The name of the method parameter, if there is one.
    Returns:
      the parameter name, if it has one

  - ### flagsMask

    int flagsMask()
    Parameter access flags for this parameter, as a bit mask. Valid parameter flags include `ClassFile.ACC_FINAL`PREVIEW, `ClassFile.ACC_SYNTHETIC`PREVIEW, and `ClassFile.ACC_MANDATED`PREVIEW.
    Returns:
      the access flags, as a bit mask

  - ### flags

    default Set<AccessFlag> flags()
    Parameter access flags for this parameter.
    Returns:
      the access flags, as a bit mask

  - ### has

    default boolean has(AccessFlag flag)
    Returns whether the method parameter has a specific flag set.
    Parameters:
      `flag` - the method parameter flag
    Returns:
      whether the method parameter has a specific flag set

  - ### of

    static MethodParameterInfoPREVIEW of(Optional<Utf8EntryPREVIEW> name, int flags)
    Returns a method parameter description.
    Parameters:
      `name` - the method parameter name
      `flags` - the method parameter access flags
    Returns:
      a method parameter description

  - ### of

    static MethodParameterInfoPREVIEW of(Optional<String> name, AccessFlag... flags)
    Returns a method parameter description.
    Parameters:
      `name` - the method parameter name
      `flags` - the method parameter access flags
    Returns:
      a method parameter description

  - ### ofParameter

    static MethodParameterInfoPREVIEW ofParameter(Optional<String> name, int flags)
    Returns a method parameter description.
    Parameters:
      `name` - the method parameter name
      `flags` - the method parameter access flags
    Returns:
      a method parameter description