/** * Safely invokes {@link javax.ws.rs.ext.MessageBodyWriter#isWriteable isWriteable} method on the underlying provider. * * Any exceptions will be logged at finer level. * * @param type the class of instance that is to be written. * @param genericType the type of instance to be written, obtained either * by reflection of a resource method return type or via inspection * of the returned instance. {@link javax.ws.rs.core.GenericEntity} * provides a way to specify this information at runtime. * @param annotations an array of the annotations attached to the message entity instance. * @param mediaType the media type of the HTTP entity. * @return {@code true} if the type is supported, otherwise {@code false}. */ public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return MessageBodyFactory.isWriteable(super.provider(), type, genericType, annotations, mediaType); } }
/** * Safely invokes {@link javax.ws.rs.ext.MessageBodyWriter#isWriteable isWriteable} method on the underlying provider. * * Any exceptions will be logged at finer level. * * @param type the class of instance that is to be written. * @param genericType the type of instance to be written, obtained either * by reflection of a resource method return type or via inspection * of the returned instance. {@link javax.ws.rs.core.GenericEntity} * provides a way to specify this information at runtime. * @param annotations an array of the annotations attached to the message entity instance. * @param mediaType the media type of the HTTP entity. * @return {@code true} if the type is supported, otherwise {@code false}. */ public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return MessageBodyFactory.isWriteable(super.provider(), type, genericType, annotations, mediaType); } }
/** * Safely invokes {@link javax.ws.rs.ext.MessageBodyReader#isReadable isReadable} method on the underlying provider. * * Any exceptions will be logged at finer level. * * @param type the class of instance to be produced. * @param genericType the type of instance to be produced. E.g. if the * message body is to be converted into a method parameter, this will be * the formal type of the method parameter as returned by * {@code Method.getGenericParameterTypes}. * @param annotations an array of the annotations on the declaration of the * artifact that will be initialized with the produced instance. E.g. if the * message body is to be converted into a method parameter, this will be * the annotations on that parameter returned by * {@code Method.getParameterAnnotations}. * @param mediaType the media type of the HTTP entity, if one is not * specified in the request then {@code application/octet-stream} is * used. * @return {@code true} if the type is supported, otherwise {@code false}. */ public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return MessageBodyFactory.isReadable(super.provider(), type, genericType, annotations, mediaType); } }
/** * Safely invokes {@link javax.ws.rs.ext.MessageBodyReader#isReadable isReadable} method on the underlying provider. * * Any exceptions will be logged at finer level. * * @param type the class of instance to be produced. * @param genericType the type of instance to be produced. E.g. if the * message body is to be converted into a method parameter, this will be * the formal type of the method parameter as returned by * {@code Method.getGenericParameterTypes}. * @param annotations an array of the annotations on the declaration of the * artifact that will be initialized with the produced instance. E.g. if the * message body is to be converted into a method parameter, this will be * the annotations on that parameter returned by * {@code Method.getParameterAnnotations}. * @param mediaType the media type of the HTTP entity, if one is not * specified in the request then {@code application/octet-stream} is * used. * @return {@code true} if the type is supported, otherwise {@code false}. */ public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return MessageBodyFactory.isReadable(super.provider(), type, genericType, annotations, mediaType); } }
@Override public int compare(final AbstractEntityProviderModel<T> modelA, final AbstractEntityProviderModel<T> modelB) { if (modelA.isCustom() ^ modelB.isCustom()) { return (modelA.isCustom()) ? -1 : 1; } final MediaType mtA = modelA.declaredTypes().get(0); final MediaType mtB = modelB.declaredTypes().get(0); final int mediaTypeComparison = MediaTypes.PARTIAL_ORDER_COMPARATOR.compare(mtA, mtB); if (mediaTypeComparison != 0 && !mtA.isCompatible(mtB)) { return mediaTypeComparison; } return distanceComparator.compare(modelA.provider(), modelB.provider()); } }
@Override public int compare(final AbstractEntityProviderModel<T> modelA, final AbstractEntityProviderModel<T> modelB) { if (modelA.isCustom() ^ modelB.isCustom()) { return (modelA.isCustom()) ? -1 : 1; } final MediaType mtA = modelA.declaredTypes().get(0); final MediaType mtB = modelB.declaredTypes().get(0); final int mediaTypeComparison = MediaTypes.PARTIAL_ORDER_COMPARATOR.compare(mtA, mtB); if (mediaTypeComparison != 0 && !mtA.isCompatible(mtB)) { return mediaTypeComparison; } return distanceComparator.compare(modelA.provider(), modelB.provider()); } }
writersCache.put(mt, writerList); writerList.add(model.provider());
writersCache.put(mt, writerList); writerList.add(model.provider());
private static <T> void getCompatibleProvidersList( final MediaType mediaType, final List<? extends AbstractEntityProviderModel<T>> set, final Map<MediaType, List<T>> subSet) { final List<T> providers = new ArrayList<T>(); for (final AbstractEntityProviderModel<T> model : set) { if (model.declaredTypes().contains(mediaType)) { providers.add(model.provider()); } } if (!providers.isEmpty()) { subSet.put(mediaType, Collections.unmodifiableList(providers)); } }
private static <T> void getCompatibleProvidersList( final MediaType mediaType, final List<? extends AbstractEntityProviderModel<T>> set, final Map<MediaType, List<T>> subSet) { final List<T> providers = new ArrayList<T>(); for (final AbstractEntityProviderModel<T> model : set) { if (model.declaredTypes().contains(mediaType)) { providers.add(model.provider()); } } if (!providers.isEmpty()) { subSet.put(mediaType, Collections.unmodifiableList(providers)); } }
private static <T> void getCompatibleProvidersList( final MediaType mediaType, final List<? extends AbstractEntityProviderModel<T>> set, final Map<MediaType, List<T>> subSet) { final List<T> providers = new ArrayList<T>(); for (final AbstractEntityProviderModel<T> model : set) { if (model.declaredTypes().contains(mediaType)) { providers.add(model.provider()); } } if (!providers.isEmpty()) { subSet.put(mediaType, Collections.unmodifiableList(providers)); } }
/** * Safely invokes {@link javax.ws.rs.ext.MessageBodyWriter#isWriteable isWriteable} method on the underlying provider. * * Any exceptions will be logged at finer level. * * @param type the class of instance that is to be written. * @param genericType the type of instance to be written, obtained either * by reflection of a resource method return type or via inspection * of the returned instance. {@link javax.ws.rs.core.GenericEntity} * provides a way to specify this information at runtime. * @param annotations an array of the annotations attached to the message entity instance. * @param mediaType the media type of the HTTP entity. * @return {@code true} if the type is supported, otherwise {@code false}. */ public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return MessageBodyFactory.isWriteable(super.provider(), type, genericType, annotations, mediaType); } }
/** * Safely invokes {@link javax.ws.rs.ext.MessageBodyWriter#isWriteable isWriteable} method on the underlying provider. * * Any exceptions will be logged at finer level. * * @param type the class of instance that is to be written. * @param genericType the type of instance to be written, obtained either * by reflection of a resource method return type or via inspection * of the returned instance. {@link javax.ws.rs.core.GenericEntity} * provides a way to specify this information at runtime. * @param annotations an array of the annotations attached to the message entity instance. * @param mediaType the media type of the HTTP entity. * @return {@code true} if the type is supported, otherwise {@code false}. */ public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return MessageBodyFactory.isWriteable(super.provider(), type, genericType, annotations, mediaType); } }
/** * Safely invokes {@link javax.ws.rs.ext.MessageBodyWriter#isWriteable isWriteable} method on the underlying provider. * * Any exceptions will be logged at finer level. * * @param type the class of instance that is to be written. * @param genericType the type of instance to be written, obtained either * by reflection of a resource method return type or via inspection * of the returned instance. {@link javax.ws.rs.core.GenericEntity} * provides a way to specify this information at runtime. * @param annotations an array of the annotations attached to the message entity instance. * @param mediaType the media type of the HTTP entity. * @return {@code true} if the type is supported, otherwise {@code false}. */ public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return MessageBodyFactory.isWriteable(super.provider(), type, genericType, annotations, mediaType); } }
/** * Safely invokes {@link javax.ws.rs.ext.MessageBodyWriter#isWriteable isWriteable} method on the underlying provider. * * Any exceptions will be logged at finer level. * * @param type the class of instance that is to be written. * @param genericType the type of instance to be written, obtained either * by reflection of a resource method return type or via inspection * of the returned instance. {@link javax.ws.rs.core.GenericEntity} * provides a way to specify this information at runtime. * @param annotations an array of the annotations attached to the message entity instance. * @param mediaType the media type of the HTTP entity. * @return {@code true} if the type is supported, otherwise {@code false}. */ public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return MessageBodyFactory.isWriteable(super.provider(), type, genericType, annotations, mediaType); } }
@Override public int compare(final AbstractEntityProviderModel<T> modelA, final AbstractEntityProviderModel<T> modelB) { if (modelA.isCustom() ^ modelB.isCustom()) { return (modelA.isCustom()) ? -1 : 1; } final MediaType mtA = modelA.declaredTypes().get(0); final MediaType mtB = modelB.declaredTypes().get(0); final int mediaTypeComparison = MediaTypes.PARTIAL_ORDER_COMPARATOR.compare(mtA, mtB); if (mediaTypeComparison != 0 && !mtA.isCompatible(mtB)) { return mediaTypeComparison; } return distanceComparator.compare(modelA.provider(), modelB.provider()); } }
@Override public int compare(final AbstractEntityProviderModel<T> modelA, final AbstractEntityProviderModel<T> modelB) { if (modelA.isCustom() ^ modelB.isCustom()) { return (modelA.isCustom()) ? -1 : 1; } final MediaType mtA = modelA.declaredTypes().get(0); final MediaType mtB = modelB.declaredTypes().get(0); final int mediaTypeComparison = MediaTypes.PARTIAL_ORDER_COMPARATOR.compare(mtA, mtB); if (mediaTypeComparison != 0 && !mtA.isCompatible(mtB)) { return mediaTypeComparison; } return distanceComparator.compare(modelA.provider(), modelB.provider()); } }
@Override public int compare(final AbstractEntityProviderModel<T> modelA, final AbstractEntityProviderModel<T> modelB) { if (modelA.isCustom() ^ modelB.isCustom()) { return (modelA.isCustom()) ? -1 : 1; } final MediaType mtA = modelA.declaredTypes().get(0); final MediaType mtB = modelB.declaredTypes().get(0); final int mediaTypeComparison = MediaTypes.PARTIAL_ORDER_COMPARATOR.compare(mtA, mtB); if (mediaTypeComparison != 0 && !mtA.isCompatible(mtB)) { return mediaTypeComparison; } return distanceComparator.compare(modelA.provider(), modelB.provider()); } }
@Override public int compare(final AbstractEntityProviderModel<T> modelA, final AbstractEntityProviderModel<T> modelB) { if (modelA.isCustom() ^ modelB.isCustom()) { return (modelA.isCustom()) ? -1 : 1; } final MediaType mtA = modelA.declaredTypes().get(0); final MediaType mtB = modelB.declaredTypes().get(0); final int mediaTypeComparison = MediaTypes.PARTIAL_ORDER_COMPARATOR.compare(mtA, mtB); if (mediaTypeComparison != 0 && !mtA.isCompatible(mtB)) { return mediaTypeComparison; } return distanceComparator.compare(modelA.provider(), modelB.provider()); } }
@Override public int compare(final AbstractEntityProviderModel<T> modelA, final AbstractEntityProviderModel<T> modelB) { if (modelA.isCustom() ^ modelB.isCustom()) { return (modelA.isCustom()) ? -1 : 1; } final MediaType mtA = modelA.declaredTypes().get(0); final MediaType mtB = modelB.declaredTypes().get(0); final int mediaTypeComparison = MediaTypes.PARTIAL_ORDER_COMPARATOR.compare(mtA, mtB); if (mediaTypeComparison != 0 && !mtA.isCompatible(mtB)) { return mediaTypeComparison; } return distanceComparator.compare(modelA.provider(), modelB.provider()); } }