ModuleDescriptor.Requires (Java SE 10 & JDK 10 ) (original) (raw)
- java.lang.module.ModuleDescriptor.Requires
All Implemented Interfaces:
[Comparable](../../../java/lang/Comparable.html "interface in java.lang")<[ModuleDescriptor.Requires](../../../java/lang/module/ModuleDescriptor.Requires.html "class in java.lang.module")>
Enclosing class:
ModuleDescriptor
public static final class ModuleDescriptor.Requires
extends Object
implements Comparable<ModuleDescriptor.Requires>
A dependence upon a module
Since:
9
See Also:
ModuleDescriptor.requires()
Nested Class Summary
Nested Classes
Modifier and Type Class Description static class ModuleDescriptor.Requires.Modifier A modifier on a module dependence. Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type Method Description int compareTo(ModuleDescriptor.Requires that) Compares this module dependence to another. Optional<ModuleDescriptor.Version> compiledVersion() Returns the version of the module if recorded at compile-time. boolean equals(Object ob) Tests this module dependence for equality with the given object. int hashCode() Computes a hash code for this module dependence. Set<ModuleDescriptor.Requires.Modifier> modifiers() Returns the set of modifiers. String name() Return the module name. Optional<String> rawCompiledVersion() Returns the string with the possibly-unparseable version of the module if recorded at compile-time. String toString() Returns a string describing this module dependence. * ### Methods declared in class java.lang.[Object](../../../java/lang/Object.html "class in java.lang") `[clone](../../../java/lang/Object.html#clone%28%29), [finalize](../../../java/lang/Object.html#finalize%28%29), [getClass](../../../java/lang/Object.html#getClass%28%29), [notify](../../../java/lang/Object.html#notify%28%29), [notifyAll](../../../java/lang/Object.html#notifyAll%28%29), [wait](../../../java/lang/Object.html#wait%28%29), [wait](../../../java/lang/Object.html#wait%28long%29), [wait](../../../java/lang/Object.html#wait%28long,int%29)`
Method Detail
* #### modifiers public [Set](../../../java/util/Set.html "interface in java.util")<[ModuleDescriptor.Requires.Modifier](../../../java/lang/module/ModuleDescriptor.Requires.Modifier.html "enum in java.lang.module")> modifiers() Returns the set of modifiers. Returns: A possibly-empty unmodifiable set of modifiers * #### name public [String](../../../java/lang/String.html "class in java.lang") name() Return the module name. Returns: The module name * #### compiledVersion public [Optional](../../../java/util/Optional.html "class in java.util")<[ModuleDescriptor.Version](../../../java/lang/module/ModuleDescriptor.Version.html "class in java.lang.module")> compiledVersion() Returns the version of the module if recorded at compile-time. Returns: The version of the module if recorded at compile-time, or an empty `Optional` if no version was recorded or the version string recorded is [unparseable](../../../java/lang/module/ModuleDescriptor.Version.html#parse%28java.lang.String%29) * #### rawCompiledVersion public [Optional](../../../java/util/Optional.html "class in java.util")<[String](../../../java/lang/String.html "class in java.lang")> rawCompiledVersion() Returns the string with the possibly-unparseable version of the module if recorded at compile-time. Returns: The string containing the version of the module if recorded at compile-time, or an empty `Optional` if no version was recorded See Also: [compiledVersion()](../../../java/lang/module/ModuleDescriptor.Requires.html#compiledVersion%28%29) * #### compareTo public int compareTo([ModuleDescriptor.Requires](../../../java/lang/module/ModuleDescriptor.Requires.html "class in java.lang.module") that) Compares this module dependence to another. Two `Requires` objects are compared by comparing their module names lexicographically. Where the module names are equal then the sets of modifiers are compared in the same way that module modifiers are compared (see [ModuleDescriptor.compareTo](../../../java/lang/module/ModuleDescriptor.html#compareTo%28java.lang.module.ModuleDescriptor%29)). Where the module names are equal and the set of modifiers are equal then the version of the modules recorded at compile-time are compared. When comparing the versions recorded at compile-time then a dependence that has a recorded version is considered to succeed a dependence that does not have a recorded version. If both recorded versions are [unparseable](../../../java/lang/module/ModuleDescriptor.Version.html#parse%28java.lang.String%29) then the [raw version strings](../../../java/lang/module/ModuleDescriptor.Requires.html#rawCompiledVersion%28%29) are compared lexicographically. Specified by: `[compareTo](../../../java/lang/Comparable.html#compareTo%28T%29)` in interface `[Comparable](../../../java/lang/Comparable.html "interface in java.lang")<[ModuleDescriptor.Requires](../../../java/lang/module/ModuleDescriptor.Requires.html "class in java.lang.module")>` Parameters: `that` \- The module dependence to compare Returns: A negative integer, zero, or a positive integer if this module dependence is less than, equal to, or greater than the given module dependence * #### equals public boolean equals([Object](../../../java/lang/Object.html "class in java.lang") ob) Tests this module dependence for equality with the given object. If the given object is not a `Requires` then this method returns `false`. Two module dependence objects are equal if the module names are equal, set of modifiers are equal, and the compiled version of both modules is equal or not recorded for both modules. This method satisfies the general contract of the [Object.equals](../../../java/lang/Object.html#equals%28java.lang.Object%29) method. Overrides: `[equals](../../../java/lang/Object.html#equals%28java.lang.Object%29)` in class `[Object](../../../java/lang/Object.html "class in java.lang")` Parameters: `ob` \- the object to which this object is to be compared Returns: `true` if, and only if, the given object is a module dependence that is equal to this module dependence See Also: [Object.hashCode()](../../../java/lang/Object.html#hashCode%28%29), [HashMap](../../../java/util/HashMap.html "class in java.util") * #### hashCode public int hashCode() Computes a hash code for this module dependence. The hash code is based upon the module name, modifiers, and the module version if recorded at compile time. It satisfies the general contract of the [Object.hashCode](../../../java/lang/Object.html#hashCode%28%29) method. Overrides: `[hashCode](../../../java/lang/Object.html#hashCode%28%29)` in class `[Object](../../../java/lang/Object.html "class in java.lang")` Returns: The hash-code value for this module dependence See Also: [Object.equals(java.lang.Object)](../../../java/lang/Object.html#equals%28java.lang.Object%29), [System.identityHashCode(java.lang.Object)](../../../java/lang/System.html#identityHashCode%28java.lang.Object%29) * #### toString public [String](../../../java/lang/String.html "class in java.lang") toString() Returns a string describing this module dependence. Overrides: `[toString](../../../java/lang/Object.html#toString%28%29)` in class `[Object](../../../java/lang/Object.html "class in java.lang")` Returns: A string describing this module dependence
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2018, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.