Comparable<ModuleDescriptor.Exports>
ModuleDescriptor
public static final class ModuleDescriptor.Exports extends Object implements Comparable<ModuleDescriptor.Exports>
A package exported by a module, may be qualified or unqualified.
Modifier and Type | Class | Description |
---|---|---|
static enum |
ModuleDescriptor.Exports.Modifier |
A modifier on an exported package. |
Modifier and Type | Method | Description |
---|---|---|
Set |
accessFlags() |
Returns the set of the module export flags for this module descriptor. |
int |
compareTo |
Compares this module export to another. |
boolean |
equals |
Tests this module export for equality with the given object. |
int |
hashCode() |
Computes a hash code for this module export. |
boolean |
isQualified() |
Returns true if this is a qualified export. |
Set |
modifiers() |
Returns the set of modifiers. |
String |
source() |
Returns the package name. |
Set |
targets() |
For a qualified export, returns the non-empty and immutable set of the module names to which the package is exported. |
String |
toString() |
Returns a string describing the exported package. |
public Set<ModuleDescriptor.Exports.Modifier> modifiers()
public Set<AccessFlag> accessFlags()
public boolean isQualified()
true
if this is a qualified export.true
if this is a qualified exportpublic String source()
public Set<String> targets()
public int compareTo(ModuleDescriptor.Exports that)
Two Exports
objects are compared by comparing the package names lexicographically. Where the packages names are equal then the sets of modifiers are compared in the same way that module modifiers are compared (see ModuleDescriptor.compareTo
). Where the package names are equal and the set of modifiers are equal then the set of target modules are compared. This is done by sorting the names of the target modules in ascending order, and according to their natural ordering, and then comparing the corresponding elements lexicographically. Where the sets differ in size, and the larger set contains all elements of the smaller set, then the larger set is considered to succeed the smaller set.
compareTo
in interface Comparable<ModuleDescriptor.Exports>
that
- The module export to comparepublic int hashCode()
The hash code is based upon the modifiers, the package name, and for a qualified export, the set of modules names to which the package is exported. It satisfies the general contract of the Object.hashCode
method.
public boolean equals(Object ob)
If the given object is not an Exports
then this method returns false
. Two module exports objects are equal if their set of modifiers is equal, the package names are equal and the set of target module names is equal.
This method satisfies the general contract of the Object.equals
method.
public String toString()
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/module/ModuleDescriptor.Exports.html