- All Implemented Interfaces:
- Comparable<ModuleDescriptor.Opens>
- Enclosing class:
- ModuleDescriptor
A package opened by a module, may be qualified or unqualified.
The opens directive in a module declaration declares a package to be open to allow all types in the package, and all their members, not just public types and their public members to be reflected on by APIs that support private access or a way to bypass or suppress default Java language access control checks.
- Since:
- 9
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumA modifier on an open package.
- 
Method SummaryModifier and TypeMethodDescriptionintCompares this moduleOpensto another.booleanTests this moduleOpensfor equality with the given object.inthashCode()Computes a hash code for this moduleOpens.booleanReturnstrueif this is a qualifiedOpens.Returns the set of modifiers.source()Returns the package name.targets()For a qualifiedOpens, returns the non-empty and immutable set of the module names to which the package is open.toString()Returns a string describing the open package.
- 
Method Details- 
modifiersReturns the set of modifiers.- Returns:
- A possibly-empty unmodifiable set of modifiers
 
- 
isQualifiedpublic boolean isQualified()Returnstrueif this is a qualifiedOpens.- Returns:
- trueif this is a qualified- Opens
 
- 
sourceReturns the package name.- Returns:
- The package name
 
- 
targetsFor a qualifiedOpens, returns the non-empty and immutable set of the module names to which the package is open. For an unqualifiedOpens, returns an empty set.- Returns:
- The set of target module names or for an unqualified
         Opens, an empty set
 
- 
compareToCompares this moduleOpensto another.Two Opensobjects 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 (seeModuleDescriptor.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.- Specified by:
- compareToin interface- Comparable<ModuleDescriptor.Opens>
- Parameters:
- that- The module- Opensto compare
- Returns:
- A negative integer, zero, or a positive integer if this module
         Opensis less than, equal to, or greater than the given moduleOpens
 
- 
hashCodepublic int hashCode()Computes a hash code for this moduleOpens.The hash code is based upon the modifiers, the package name, and for a qualified Opens, the set of modules names to which the package is opened. It satisfies the general contract of theObject.hashCodemethod.
- 
equalsTests this moduleOpensfor equality with the given object.If the given object is not an Opensthen this method returnsfalse. TwoOpensobjects 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.equalsmethod.
- 
toStringReturns a string describing the open package.
 
-