Package org.jdrupes.httpcodec.types
Class MediaRange
java.lang.Object
org.jdrupes.httpcodec.types.ParameterizedValue<MediaBase.MediaTypePair>
org.jdrupes.httpcodec.types.MediaBase
org.jdrupes.httpcodec.types.MediaRange
- All Implemented Interfaces:
Comparable<MediaRange>
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A builder for the (immutable) parameterized type.static class
Nested classes/interfaces inherited from class org.jdrupes.httpcodec.types.MediaBase
MediaBase.MediaTypePair, MediaBase.MediaTypePairConverter
Nested classes/interfaces inherited from class org.jdrupes.httpcodec.types.ParameterizedValue
ParameterizedValue.ParameterizedValueConverter<T>, ParameterizedValue.ParamValueConverterBase<P extends ParameterizedValue<U>,
U> -
Field Summary
Fields inherited from class org.jdrupes.httpcodec.types.ParameterizedValue
WEIGHT_COMPARATOR
-
Constructor Summary
ConstructorDescriptionMediaRange
(String type, String subtype) Create a new object with the given type and subtype.Create a new object with the given type, subtype and parameters.MediaRange
(MediaBase.MediaTypePair type, Map<String, String> parameters) Create a new object with the given type and parameters. -
Method Summary
Modifier and TypeMethodDescriptionstatic MediaRange.Builder
builder()
Creates a new builder for a media type.int
compareTo
(MediaRange other) boolean
Checks if the given media type falls within this range.Methods inherited from class org.jdrupes.httpcodec.types.MediaBase
subtype, topLevelType
Methods inherited from class org.jdrupes.httpcodec.types.ParameterizedValue
equals, hashCode, parameter, parameters, toString, value
-
Field Details
-
ALL_MEDIA
-
-
Constructor Details
-
MediaRange
Create a new object with the given type and subtype.- Parameters:
type
- the top-level typesubtype
- the subtype
-
MediaRange
Create a new object with the given type, subtype and parameters.- Parameters:
type
- the top-level typesubtype
- the subtypeparameters
- the parameters
-
MediaRange
Create a new object with the given type and parameters.- Parameters:
type
- the typeparameters
- the parameters
-
-
Method Details
-
compareTo
- Specified by:
compareTo
in interfaceComparable<MediaRange>
-
matches
Checks if the given media type falls within this range.- Parameters:
type
- the type to check- Returns:
- the result
-
builder
Creates a new builder for a media type.- Returns:
- the builder
-