- All Superinterfaces:
Comparable<Weighted>
- All Known Subinterfaces:
GeneratedService.Descriptor<T>
,ServiceInfo
- All Known Implementing Classes:
io.helidon.inject.runtime.AbstractServiceProvider
,AccessLogFeature
,AccessLogRoutingFeature
,ContextFeature
,CorsFeature
,GzipEncodingProvider
,JacksonMediaSupportProvider
,JsonbMediaSupportProvider
,JsonpMediaSupportProvider
,LimitsFeature
,ObserveFeature
,OciAuthenticationDetailsProvider$$Injection$$Activator
,OciAvailabilityDefault$$Injection$$Activator
,OciRegionProvider$$Injection$$Activator
,OpenApiFeature
,SecurityFeature
,SecurityHttpFeature
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
Modifier and TypeFieldDescriptionstatic final double
Default weight for any weighted component (whether it implements this interface or usesWeight
annotation). -
Method Summary
-
Field Details
-
DEFAULT_WEIGHT
static final double DEFAULT_WEIGHTDefault weight for any weighted component (whether it implements this interface or usesWeight
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 theWeight
annotation rather than implementing this interface as long as it is supported by the library using thisWeighted
.- Returns:
- the weight of this service, must be a non-negative number
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Weighted>
-