Look up the {@link AffordanceModel} for the requested {@link MediaType}.

@param mediaType
@return
433138
@Nullable
	@SuppressWarnings("unchecked")
	public <T extends AffordanceModel> T getAffordanceModel(MediaType mediaType) {
		return (T) this.affordanceModels.get(mediaType);
	}
21669
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
		if (!hasMatchingMediaType(mediaType)) {
			return false;
		}

		return isValidType(type, annotations);
	}
1091286
public GenericDraweeHierarchyBuilder setActualImageScaleType(
      @Nullable ScalingUtils.ScaleType actualImageScaleType) {
    mActualImageScaleType = actualImageScaleType;
    mActualImageMatrix = null;
    return this;
  }
1266289
private <T> boolean matchesWriterMediaTypes(ProviderInfo<MessageBodyWriter<?>> pi,
                                                MediaType mediaType) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "matchesWriterMediaTypes ",  new Object[]{pi, mediaType});
        }
        MessageBodyWriter<?> ep = pi.getProvider();
        List<MediaType> supportedMediaTypes = JAXRSUtils.getProviderProduceTypes(ep);

        return JAXRSUtils.doMimeTypesIntersect(Collections.singletonList(mediaType), supportedMediaTypes);
    }
1142346
public static IRI getProfile(final List<MediaType> acceptableTypes, final RDFSyntax syntax) {
        for (final MediaType type : acceptableTypes) {
            if (RDFSyntax.byMediaType(type.toString()).filter(syntax::equals).isPresent() &&
                    type.getParameters().containsKey("profile")) {
                return rdf.createIRI(type.getParameters().get("profile").split(" ")[0].trim());
            }
        }
        return null;
    }
610624
@Override
	public String[] selectImports(AnnotationMetadata metadata) {

		Map<String, Object> attributes = metadata.getAnnotationAttributes(EnableHypermediaSupport.class.getName());

		Collection<MediaType> types = attributes == null ? Collections.emptyList()
				: Arrays.stream((HypermediaType[]) attributes.get("type")) //
						.flatMap(it -> it.getMediaTypes().stream()) //
						.collect(Collectors.toList());

		Collection<MediaTypeConfigurationProvider> configurationProviders = SpringFactoriesLoader.loadFactories(
				MediaTypeConfigurationProvider.class, HypermediaConfigurationImportSelector.class.getClassLoader());

		// No additional filtering needed.
		if (types.isEmpty()) {
			return configurationProviders.toArray(new String[0]);
		}

		// Filter the ones supporting the given media types
		return configurationProviders.stream() //
				.filter(it -> it.supportsAny(types)) //
				.map(MediaTypeConfigurationProvider::getConfiguration) //
				.map(Class::getName) //
				.toArray(String[]::new);
	}
852874
public ResourceDescription getChildDescription(String type, String name) {
        if (hasChildrenDefined()) {
            List<Property> children = get("children").asPropertyList();
            for (Property child : children) {
                if (type.equals(child.getName()) && child.getValue().hasDefined(MODEL_DESCRIPTION)) {
                    List<Property> modelDescriptions = child.getValue().get(MODEL_DESCRIPTION).asPropertyList();
                    for (Property modelDescription : modelDescriptions) {
                        if (name.equals(modelDescription.getName())) {
                            return new ResourceDescription(modelDescription.getValue());
                        }
                    }
                }
            }
        }
        return EMPTY;
    }
1085003
@SuppressWarnings("unchecked")
    public <T> Serializer<T> getSerializer(Class<T> type, String mediaType) throws SerializationException {
        checkNotNull(type, "Type (Class<T>) cannot be null.");
        checkNotNull(mediaType, "Media-Type cannot be null.");

        final String typeName = getClassName(type);
        final Key key = new Key(typeName, mediaType);

        logger.log(Level.FINE, "Querying for Serializer of type '" + typeName + "' and " + "media-type '" + mediaType
                + "'.");

        ArrayList<SerializerHolder> holders = serializers.get(typeName);
        if (holders != null) {
            for (SerializerHolder holder : holders) {
                if (holder.key.matches(key)) {
                    logger.log(Level.FINE, "Serializer for type '" + holder.serializer.handledType() + "' and " +
                            "media-type '" + Arrays.toString(holder.serializer.mediaType()) + "' matched: " +
                            holder.serializer.getClass().getName());
                    return (Serializer<T>) holder.serializer;
                }
            }
        }

        logger.log(Level.WARNING, "There is no Serializer registered for type " + type.getName() +
                " and media-type " + mediaType + ". If you're relying on auto-generated serializers," +
                " please make sure you imported the correct GWT Module.");

        return null;
    }
201392
protected String getMediaType(
            HttpServletRequest req,
            HttpServletResponse res,
            PipelineEventReader<CharacterEventReader, CharacterEvent> pipelineEventReader) {
        final String mediaType = pipelineEventReader.getOutputProperty(OutputKeys.MEDIA_TYPE);
        if (mediaType != null) {
            return mediaType;
        }

        this.logger.warn(
                "No mediaType was specified in the pipeline output properties, defaulting to "
                        + DEFAULT_MEDIA_TYPE);
        return DEFAULT_MEDIA_TYPE;
    }
862315
public RestHandlerExceptionResolverBuilder defaultContentType(String mediaType) {
        defaultContentType( hasText(mediaType) ? MediaType.parseMediaType(mediaType) : null );
        return this;
    }
329132
public <T extends Annotation> StereotypeModel<T> getStereotype(final Class<T> stereotype) {
        return stereotypes.getCastValue(stereotype);
    }
1123503
public static MediaType getMediaTypeByExtension(String extension) {
        final String input = EXTENSIONS.get(extension);
        if (input == null) {
            return null;
        }
        return MediaType.parse(input);
    }
59004
public static Intent getChooseMediaIntent(String mimeType){
        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        intent.setType(mimeType);
        return intent;
    }
473889
static TypeKey get(TypeMirror type) {
    Set<TypeParameterElement> visited = new HashSet<>();
    return type.accept(TypeKeyVisitor.INSTANCE, visited);
  }
1001492
protected static MediaType getSupportProduceMediaType(ContainerRequestContext containerRequestContext) {
        for (MediaType mediaType : containerRequestContext.getAcceptableMediaTypes()) {
            if (mediaType.isCompatible(TEXT_PLAIN_TYPE) ||
                    (mediaType.getType().equalsIgnoreCase("application")
                            && !mediaType.getSubtype().toLowerCase().contains("html"))
                    || mediaType.getSubtype().equalsIgnoreCase("json")
                    || mediaType.getSubtype().equalsIgnoreCase("xml")
                    || mediaType.getSubtype().toLowerCase().endsWith("+json")
                    || mediaType.getSubtype().toLowerCase().endsWith("+xml")) {
                return mediaType;
            }
        }
        return null;
    }
1036209
protected static <AdapterType> AdapterType getAdapter(Resource resource, Class<AdapterType> type) {
        if (type == ResourceHandle.class) {
            return type.cast(new ResourceHandle(resource));
        }
        log.info("Unable to adapt resource on {} to type {}", resource.getPath(), type.getName());
        return null;
    }
349968
private void addMediaTypes(final MethodResult methodResult, final ClassResult classResult, final ResourceMethod resourceMethod) {
        // accept media types -> inherit
        resourceMethod.getRequestMediaTypes().addAll(methodResult.getRequestMediaTypes());
        if (resourceMethod.getRequestMediaTypes().isEmpty()) {
            resourceMethod.getRequestMediaTypes().addAll(classResult.getRequestMediaTypes());
        }

        // response media types -> use annotations if not yet present
        if (resourceMethod.getResponseMediaTypes().isEmpty())
            resourceMethod.getResponseMediaTypes().addAll(methodResult.getResponseMediaTypes());
        // -> inherit
        if (resourceMethod.getResponseMediaTypes().isEmpty()) {
            resourceMethod.getResponseMediaTypes().addAll(classResult.getResponseMediaTypes());
        }
    }