Module java.money

Interface ServiceProvider


public interface ServiceProvider
This class models the component that is managing the lifecycle of the monetary services used by the Money and Currency API.
Author:
Anatole Tresch, Werner Keil
  • Method Summary

    Modifier and Type Method Description
    int getPriority()
    This method allows to define a priority for a registered ServiceProvider instance.
    default <T> T getService​(java.lang.Class<T> serviceType)
    Access a single service, given its type.
    <T> java.util.List<T> getServices​(java.lang.Class<T> serviceType)
    Access a list of services, given its type.
  • Method Details

    • getPriority

      int getPriority()
      This method allows to define a priority for a registered ServiceProvider instance. When multiple providers are registered in the system the provider with the highest priority value is taken.
      Returns:
      the provider's priority (default is 0).
    • getServices

      <T> java.util.List<T> getServices​(java.lang.Class<T> serviceType)
      Access a list of services, given its type. The bootstrap mechanism should order the instance for precedence, hereby the most significant should be first in order. If no such services are found, an empty list should be returned.
      Parameters:
      serviceType - the service type.
      Returns:
      The instance to be used, never null
    • getService

      default <T> T getService​(java.lang.Class<T> serviceType)
      Access a single service, given its type. The bootstrap mechanism should order the instance for precedence, hereby the most significant should be first in order and returned. If no such services are found, null is returned.
      Parameters:
      serviceType - the service type.
      Returns:
      The instance, (with highest precedence) or null, if no such service is available.