Class CombinedMediaType


  • final class CombinedMediaType
    extends java.lang.Object
    Represents function S as defined in the Request Matching part of the spec.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  CombinedMediaType.EffectiveMediaType
      Media type extended by flag indicating whether media type was obtained from user annotations Consumes or Produces or has no annotation and therefore was derived from MessageBodyWorkers.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) javax.ws.rs.core.MediaType combinedType
      Combined client/server media type, stripped of q and qs parameters.
      (package private) static java.util.Comparator<CombinedMediaType> COMPARATOR
      Comparator used to compare CombinedMediaType.
      (package private) int d
      Distance of the combined media types.
      (package private) static CombinedMediaType NO_MATCH
      Constant combined type representing no match.
      (package private) int q
      Client-specified media type quality.
      (package private) int qs
      Server-specified media type quality.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private CombinedMediaType​(javax.ws.rs.core.MediaType combinedType, int q, int qs, int d)  
    • Field Detail

      • NO_MATCH

        static final CombinedMediaType NO_MATCH
        Constant combined type representing no match.
      • combinedType

        final javax.ws.rs.core.MediaType combinedType
        Combined client/server media type, stripped of q and qs parameters.
      • q

        final int q
        Client-specified media type quality.
      • qs

        final int qs
        Server-specified media type quality.
      • d

        final int d
        Distance of the combined media types.
        • 0 - if the type and subtype of both combined media types match exactly (i.e. ["m/n" + "m/n"]).
        • 1 - if one media type contains a wildcard type or subtype value that matches a concrete type or subtype value.
        • 2 - if one of the media types is a MediaType.WILDCARD_TYPE and the other one is a concrete media type.
      • COMPARATOR

        static final java.util.Comparator<CombinedMediaType> COMPARATOR
        Comparator used to compare CombinedMediaType. The comparator sorts the elements of list in the ascending order from the most appropriate to the least appropriate combined media type.
    • Constructor Detail

      • CombinedMediaType

        private CombinedMediaType​(javax.ws.rs.core.MediaType combinedType,
                                  int q,
                                  int qs,
                                  int d)
    • Method Detail

      • b2i

        private static int b2i​(boolean b)
      • create

        static CombinedMediaType create​(javax.ws.rs.core.MediaType clientType,
                                        CombinedMediaType.EffectiveMediaType serverType)
        Create combined client/server media type. if the two types are not compatible, NO_MATCH is returned.
        Parameters:
        clientType - client-side media type.
        serverType - server-side media type.
        Returns:
        combined client/server media type.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object