/** * Convenience method for searching through all of the subtypes of all the media ranges in this header for the * presence of a subtype fragment. * * <p> * For example, given the header <js>"text/json+activity"</js>, calling * <code>hasSubtypePart(<js>"activity"</js>)</code> returns <jk>true</jk>. * * @param part The media type subtype fragment. * @return <jk>true</jk> if subtype fragment exists. */ public boolean hasSubtypePart(String part) { for (MediaTypeRange mr : this.mediaRanges) if (mr.getQValue() > 0 && mr.getMediaType().getSubTypes().indexOf(part) >= 0) return true; return false; }
/** * Convenience method for searching through all of the subtypes of all the media ranges in this header for the * presence of a subtype fragment. * * <p> * For example, given the header <js>"text/json+activity"</js>, calling * <code>hasSubtypePart(<js>"activity"</js>)</code> returns <jk>true</jk>. * * @param part The media type subtype fragment. * @return <jk>true</jk> if subtype fragment exists. */ public boolean hasSubtypePart(String part) { for (MediaTypeRange mr : this.mediaRanges) if (mr.getQValue() > 0 && mr.getMediaType().getSubTypes().indexOf(part) >= 0) return true; return false; }
/** * Convenience method for searching through all of the subtypes of all the media ranges in this header for the * presence of a subtype fragment. * * <p> * For example, given the header <js>"text/json+activity"</js>, calling * <code>hasSubtypePart(<js>"activity"</js>)</code> returns <jk>true</jk>. * * @param part The media type subtype fragment. * @return <jk>true</jk> if subtype fragment exists. */ public boolean hasSubtypePart(String part) { for (MediaTypeRange mr : this.mediaRanges) if (mr.getQValue() > 0 && mr.getMediaType().getSubTypes().indexOf(part) >= 0) return true; return false; }
@Override public Object swap(BeanSession session, PojoToDynamicReader o) throws Exception { return new StringReader(o.f + "-" + session.getMediaType().getSubTypes().get(0)); } }