Interface ModuleHashesAttribute
- All Superinterfaces:
Attribute<ModuleHashesAttribute>
,ClassElement
,ClassFileElement
public sealed interface ModuleHashesAttribute
extends Attribute<ModuleHashesAttribute>, ClassElement
Models the
ModuleHashes
attribute, which can
appear on classes that represent module descriptors. This is a JDK-specific
attribute, which captures the hashes of a set of co-delivered modules.
Delivered as a ClassElement
when
traversing the elements of a ClassModel
.
The specification of the ModuleHashes
attribute is:
ModuleHashes_attribute {
// index to CONSTANT_utf8_info structure in constant pool representing
// the string "ModuleHashes"
u2 attribute_name_index;
u4 attribute_length;
// index to CONSTANT_utf8_info structure with algorithm name
u2 algorithm_index;
// the number of entries in the hashes table
u2 hashes_count;
{ u2 module_name_index (index to CONSTANT_Module_info structure)
u2 hash_length;
u1 hash[hash_length];
} hashes[hashes_count];
}
The attribute does not permit multiple instances in a given location. Subsequent occurrence of the attribute takes precedence during the attributed element build or transformation.
- Since:
- 24
-
Method Summary
Modifier and TypeMethodDescriptionReturns the algorithm name used to compute the hash.hashes()
Returns the hash information about related modules.static ModuleHashesAttribute
of
(Utf8Entry algorithm, ModuleHashInfo... hashes) Returns aModuleHashes
attribute.static ModuleHashesAttribute
of
(Utf8Entry algorithm, List<ModuleHashInfo> hashes) Returns aModuleHashes
attribute.static ModuleHashesAttribute
of
(String algorithm, ModuleHashInfo... hashes) Returns aModuleHashes
attribute.static ModuleHashesAttribute
of
(String algorithm, List<ModuleHashInfo> hashes) Returns aModuleHashes
attribute.Methods declared in interface java.lang.classfile.Attribute
attributeMapper, attributeName
-
Method Details
-
algorithm
Utf8Entry algorithm()Returns the algorithm name used to compute the hash.- Returns:
- the algorithm name used to compute the hash
-
hashes
List<ModuleHashInfo> hashes()Returns the hash information about related modules.- Returns:
- the hash information about related modules
-
of
Returns aModuleHashes
attribute.- Parameters:
algorithm
- the hashing algorithmhashes
- the hash descriptions- Returns:
- a
ModuleHashes
attribute
-
of
Returns aModuleHashes
attribute.- Parameters:
algorithm
- the hashing algorithmhashes
- the hash descriptions- Returns:
- a
ModuleHashes
attribute
-
of
Returns aModuleHashes
attribute.- Parameters:
algorithm
- the hashing algorithmhashes
- the hash descriptions- Returns:
- a
ModuleHashes
attribute
-
of
Returns aModuleHashes
attribute.- Parameters:
algorithm
- the hashing algorithmhashes
- the hash descriptions- Returns:
- a
ModuleHashes
attribute
-