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

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

# Interface ModuleProvideInfo

public sealed interface ModuleProvideInfo
`ModuleProvideInfo` is a preview API of the Java platform.
Programs can only use `ModuleProvideInfo` 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 "provides" declaration in the `ModuleAttribute`PREVIEW.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static ModuleProvideInfoPREVIEW`
  `of(ClassEntryPREVIEW provides, ClassEntryPREVIEW... providesWith)`
  Returns a service provision description.
  `static ModuleProvideInfoPREVIEW`
  `of(ClassEntryPREVIEW provides, List<ClassEntryPREVIEW> providesWith)`
  Returns a service provision description.
  `static ModuleProvideInfoPREVIEW`
  `of(ClassDesc provides, ClassDesc... providesWith)`
  Returns a service provision description.
  `static ModuleProvideInfoPREVIEW`
  `of(ClassDesc provides, List<ClassDesc> providesWith)`
  Returns a service provision description.
  `ClassEntryPREVIEW`
  `provides()`
  Returns the service interface representing the provided service.
  `List<ClassEntryPREVIEW>`
  `providesWith()`
  Returns the classes providing the service implementation.

- ## Method Details

  - ### provides

    ClassEntryPREVIEW provides()
    Returns the service interface representing the provided service.
    Returns:
      the service interface representing the provided service

  - ### providesWith

    List<ClassEntryPREVIEW> providesWith()
    Returns the classes providing the service implementation.
    Returns:
      the classes providing the service implementation

  - ### of

    static ModuleProvideInfoPREVIEW of(ClassEntryPREVIEW provides, List<ClassEntryPREVIEW> providesWith)
    Returns a service provision description.
    Parameters:
      `provides` - the service class interface
      `providesWith` - the service class implementations
    Returns:
      a service provision description

  - ### of

    static ModuleProvideInfoPREVIEW of(ClassEntryPREVIEW provides, ClassEntryPREVIEW... providesWith)
    Returns a service provision description.
    Parameters:
      `provides` - the service class interface
      `providesWith` - the service class implementations
    Returns:
      a service provision description

  - ### of

    static ModuleProvideInfoPREVIEW of(ClassDesc provides, List<ClassDesc> providesWith)
    Returns a service provision description.
    Parameters:
      `provides` - the service class interface
      `providesWith` - the service class implementations
    Returns:
      a service provision description
    Throws:
      `IllegalArgumentException` - if `provides` represents a primitive type

  - ### of

    static ModuleProvideInfoPREVIEW of(ClassDesc provides, ClassDesc... providesWith)
    Returns a service provision description.
    Parameters:
      `provides` - the service class interface
      `providesWith` - the service class implementations
    Returns:
      a service provision description
    Throws:
      `IllegalArgumentException` - if `provides` or any of `providesWith` represents a primitive type