@Override public boolean support(MediaType mediaType) { return mediaType.equals(MediaType.APPLICATION_JSON_TYPE); }
@Override public boolean support(MediaType mediaType) { return mediaType.equals(MediaType.APPLICATION_XML_TYPE); }
@Override public boolean support(MediaType mediaType) { return mediaType.equals(MediaType.APPLICATION_XML_TYPE); }
@Override public boolean support(MediaType mediaType) { return mediaType.equals(MediaType.APPLICATION_XML_TYPE); }
@Override public boolean support(MediaType mediaType) { return mediaType.equals(MediaType.APPLICATION_JSON_TYPE); }
@Override public boolean support(MediaType mediaType) { return mediaType.equals(MediaType.APPLICATION_JSON_TYPE); }
@Override public boolean support(MediaType mediaType) { return mediaType.equals(MediaType.APPLICATION_JSON_TYPE); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof EffectiveMediaType)) { return false; } EffectiveMediaType that = (EffectiveMediaType) o; return derived == that.derived && mediaType.equals(that.mediaType); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof EffectiveMediaType)) { return false; } EffectiveMediaType that = (EffectiveMediaType) o; return derived == that.derived && mediaType.equals(that.mediaType); }
private boolean vary(MediaType v, MediaType vary) { return v != null && !v.equals(vary); }
@Override public boolean equals(Object obj) { if (!super.equals(obj)) { return false; } if (obj instanceof QualitySourceMediaType) { final QualitySourceMediaType other = (QualitySourceMediaType) obj; return this.qs == other.qs; } else { // obj is a plain MediaType instance // with a quality source factor set to default (1.0) return this.qs == Quality.DEFAULT; } }
@Override public boolean equals(Object obj) { if (!super.equals(obj)) { return false; } if (obj instanceof AcceptableMediaType) { final AcceptableMediaType other = (AcceptableMediaType) obj; return this.q == other.q; } else { // obj is a plain MediaType instance // with a quality factor set to default (1.0) return this.q == Quality.DEFAULT; } }
private boolean vary(MediaType v, MediaType vary) { return v != null && !v.equals(vary); }
private static Response createErrorReply(int status, String errorMessage, MediaType mediaType) { String message; if (MediaType.APPLICATION_JSON_TYPE.equals(mediaType)) { message = "{\"error\": \"" + errorMessage + "\"}"; } else { message = "<error><message>" + errorMessage + "</message></error>"; } return Response.status(status).entity(message).type(mediaType).build(); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final ModelLookupKey that = (ModelLookupKey) o; return !(clazz != null ? !clazz.equals(that.clazz) : that.clazz != null) && !(mediaType != null ? !mediaType.equals(that.mediaType) : that.mediaType != null); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final ModelLookupKey that = (ModelLookupKey) o; return !(clazz != null ? !clazz.equals(that.clazz) : that.clazz != null) && !(mediaType != null ? !mediaType.equals(that.mediaType) : that.mediaType != null); }
/** * @return {@code true} if this body part represents a simple, string-based, field value, otherwise {@code false}. */ public boolean isSimple() { return MediaType.TEXT_PLAIN_TYPE.equals(getMediaType()); }
/** * Sets the field value for this body part. This should be called * only on body parts representing simple field values. * * @param value the field value. * @throws IllegalStateException if called on a body part with a media type other than {@code text/plain}. */ public void setValue(String value) { if (!MediaType.TEXT_PLAIN_TYPE.equals(getMediaType())) { throw new IllegalStateException(LocalizationMessages.MEDIA_TYPE_NOT_TEXT_PLAIN()); } setEntity(value); }
@Override public int call(Object object) { AbstractEurekaJacksonCodec codec; if (mediaType.equals(MediaType.APPLICATION_JSON_TYPE)) { codec = compact ? jsonCodecNgCompact : jsonCodecNG; } else { codec = compact ? xmlCodecNgCompact : xmlCodecNG; } ByteArrayOutputStream captureStream = new ByteArrayOutputStream(); try { codec.writeTo(object, captureStream); byte[] bytes = captureStream.toByteArray(); InputStream source = new ByteArrayInputStream(bytes); Applications readValue = codec.getObjectMapper(object.getClass()).readValue(source, Applications.class); secondHolder.value = readValue; return bytes.length; } catch (IOException e) { throw new RuntimeException("unexpected", e); } } };