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

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

# Interface ModuleHashInfo

public sealed interface ModuleHashInfo
`ModuleHashInfo` is a preview API of the Java platform.
Programs can only use `ModuleHashInfo` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models hash information for a single module in the `ModuleHashesAttribute`PREVIEW.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `byte[]`
  `hash()`
  Returns the hash of the related module.
  `ModuleEntryPREVIEW`
  `moduleName()`
  Returns the name of the related module.
  `static ModuleHashInfoPREVIEW`
  `of(ModuleEntryPREVIEW moduleName, byte[] hash)`
  Returns a module hash description.
  `static ModuleHashInfoPREVIEW`
  `of(ModuleDesc moduleDesc, byte[] hash)`
  Returns a module hash description.

- ## Method Details

  - ### moduleName

    ModuleEntryPREVIEW moduleName()
    Returns the name of the related module.
    Returns:
      the name of the related module

  - ### hash

    byte[] hash()
    Returns the hash of the related module.
    Returns:
      the hash of the related module

  - ### of

    static ModuleHashInfoPREVIEW of(ModuleEntryPREVIEW moduleName, byte[] hash)
    Returns a module hash description.
    Parameters:
      `moduleName` - the module name
      `hash` - the hash value
    Returns:
      a module hash description

  - ### of

    static ModuleHashInfoPREVIEW of(ModuleDesc moduleDesc, byte[] hash)
    Returns a module hash description.
    Parameters:
      `moduleDesc` - the module name
      `hash` - the hash value
    Returns:
      a module hash description