Class ModuleDescriptor.Provides

java.lang.Object
java.lang.module.ModuleDescriptor.Provides
All Implemented Interfaces:
Comparable<ModuleDescriptor.Provides>
Enclosing class:
ModuleDescriptor

public static final class ModuleDescriptor.Provides extends Object implements Comparable<ModuleDescriptor.Provides>

A service that a module provides one or more implementations of.

Since:
9
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares this Provides to another.
    boolean
    Tests this Provides for equality with the given object.
    int
    Computes a hash code for this Provides.
    Returns the list of the binary names of the providers or provider factories.
    Returns the binary name of the service type.
    Returns a string describing this Provides.

    Methods declared in class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
  • Method Details

    • service

      public String service()
      Returns the binary name of the service type.
      Returns:
      the binary name of the service type
    • providers

      public List<String> providers()
      Returns the list of the binary names of the providers or provider factories.
      Returns:
      A non-empty and unmodifiable list of the binary names of the providers or provider factories
    • compareTo

      public int compareTo(ModuleDescriptor.Provides that)
      Compares this Provides to another.

      Two Provides objects are compared by comparing the binary name of the service type lexicographically. Where the class names are equal then the list of the provider class names are compared by comparing the corresponding elements of both lists lexicographically and in sequence. Where the lists differ in size, N is the size of the shorter list, and the first N corresponding elements are equal, then the longer list is considered to succeed the shorter list.

      Specified by:
      compareTo in interface Comparable<ModuleDescriptor.Provides>
      Parameters:
      that - The Provides to compare
      Returns:
      A negative integer, zero, or a positive integer if this Provides is less than, equal to, or greater than the given Provides
    • hashCode

      public int hashCode()
      Computes a hash code for this Provides.

      The hash code is based upon the service type and the set of providers. It satisfies the general contract of the Object.hashCode method.

      Overrides:
      hashCode in class Object
      Returns:
      The hash-code value for this module provides
      See Also:
    • equals

      public boolean equals(Object ob)
      Tests this Provides for equality with the given object.

      If the given object is not a Provides then this method returns false. Two Provides objects are equal if the service type is equal and the list of providers is equal.

      This method satisfies the general contract of the Object.equals method.

      Overrides:
      equals in class Object
      Parameters:
      ob - the object to which this object is to be compared
      Returns:
      true if, and only if, the given object is a Provides that is equal to this Provides
      See Also:
    • toString

      public String toString()
      Returns a string describing this Provides.
      Overrides:
      toString in class Object
      Returns:
      A string describing this Provides