Interface Weighted

All Superinterfaces:
Comparable<Weighted>
All Known Implementing Classes:
io.helidon.inject.runtime.AbstractServiceProvider, AccessLogFeature, AccessLogRoutingFeature, AsyncImpl$$Injection$$Activator, BulkheadImpl$$Injection$$Activator, CircuitBreakerImpl$$Injection$$Activator, io.helidon.inject.configdriven.runtime.ConfigDrivenServiceProviderBase, ConfigProducer$$Injection$$Activator, ContextFeature, CorsFeature, DefaultOciCertificatesDownloader$$Injection$$Activator, DefaultOciPrivateKeyDownloader$$Injection$$Activator, GzipEncodingProvider, JacksonMediaSupportProvider, JsonbMediaSupportProvider, JsonpMediaSupportProvider, LoomClient$$Injection$$Activator, ObserveFeature, OciAuthenticationDetailsProvider$$Injection$$Activator, OciAvailabilityDefault$$Injection$$Activator, OciRegionProvider$$Injection$$Activator, OpenApiFeature, RetryImpl$$Injection$$Activator, SecurityFeature, SecurityHttpFeature, TimeoutImpl$$Injection$$Activator

public interface Weighted extends Comparable<Weighted>
Interface to define that this class is a class with weight. One of the uses is for services loaded by a ServiceLoader.

A Weighted with higher weight is more significant than a Weighted with a lower weight.

For cases where weight is the same, implementation must define ordering of such Weighted.

Negative weights are not allowed and services using weight should throw an IllegalArgumentException if such a weight is used (unless such a service documents the specific usage of a negative weight)

A Weighted with weight 2 is more significant (will be returned before) weight 1.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    Default weight for any weighted component (whether it implements this interface or uses Weight annotation).
  • Method Summary

    Modifier and Type
    Method
    Description
    default int
     
    default double
    Weight of this class (maybe because it is defined dynamically, so it cannot be defined by an annotation).
  • Field Details

    • DEFAULT_WEIGHT

      static final double DEFAULT_WEIGHT
      Default weight for any weighted component (whether it implements this interface or uses Weight annotation).
      See Also:
  • Method Details

    • weight

      default double weight()
      Weight of this class (maybe because it is defined dynamically, so it cannot be defined by an annotation). If not dynamic, you can use the Weight annotation rather than implementing this interface as long as it is supported by the library using this Weighted.
      Returns:
      the weight of this service, must be a non-negative number
    • compareTo

      default int compareTo(Weighted o)
      Specified by:
      compareTo in interface Comparable<Weighted>