Interface Producible<E extends Enum<E> & Producible<E>>
- Type Parameters:
E
- enum type that implements this interface
- All Known Implementing Classes:
ApiVersion
,PrometheusOutputFormat
,TextOutputFormat
public interface Producible<E extends Enum<E> & Producible<E>>
Interface that can be implemented by any
Enum
that represents a finite set of
producible mime-types.
Can be used with @ReadOperation
,
@WriteOperation
and @DeleteOperation
annotations to quickly define a list of produces
values.
Producible
types can also be injected into operations when the underlying
technology supports content negotiation. For example, with web based endpoints, the
value of the Producible
enum is resolved using the Accept
header of the
request. When multiple values are equally acceptable, the value with the highest
ordinal
is used.
- Since:
- 2.5.0
- Author:
- Andy Wilkinson
-
Method Summary
Modifier and TypeMethodDescriptionMime type that can be produced.default boolean
Return if this enum value should be used as the default value when an accept header of */* is provided, or if theAccept
header is missing.
-
Method Details
-
getProducedMimeType
MimeType getProducedMimeType()Mime type that can be produced.- Returns:
- the producible mime type
-
isDefault
default boolean isDefault()Return if this enum value should be used as the default value when an accept header of */* is provided, or if theAccept
header is missing. Only one value can be marked as default. If no value is marked, then the value with the highestordinal
is used as the default.- Returns:
- if this value should be used as the default value
- Since:
- 2.5.6
-