Class Registration<T>

java.lang.Object
space.arim.omnibus.registry.Registration<T>
Type Parameters:
T - the service type
All Implemented Interfaces:
Comparable<Registration<T>>

public final class Registration<T> extends Object implements Comparable<Registration<T>>
A registration wrapper for a specific service, including a registration priority, service provider implementing the service, and accompanying optional display name.
Author:
A248
  • Constructor Details

    • Registration

      public Registration(byte priority, T provider, String name)
      Creates from a priority, provider, and display name.
      Parameters:
      priority - the priority of the registration
      provider - the provider which implements the service
      name - the name
      Throws:
      NullPointerException - if provider or name is null
  • Method Details

    • getPriority

      public byte getPriority()
      The priority of this registration. If multiple registrations for the same service exist, the higher priority registration is used.
      Returns:
      the priority
    • getProvider

      public T getProvider()
      Gets the provider, or the actual service.
      Returns:
      the service provider, never null
    • getName

      public String getName()
      Gets a friendly display name for the service.
      Returns:
      the name, never null
    • compareTo

      public int compareTo(Registration<T> other)
      Specified by:
      compareTo in interface Comparable<T>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object