List of usage examples for com.fasterxml.jackson.core JsonGenerator writeEndArray
public abstract void writeEndArray() throws IOException, JsonGenerationException;
From source file:de.escalon.hypermedia.spring.de.escalon.hypermedia.spring.jackson.LinkListSerializer.java
@Override public void serialize(List<Link> links, JsonGenerator jgen, SerializerProvider serializerProvider) throws IOException { try {//from www.j a va 2 s. c o m Collection<Link> simpleLinks = new ArrayList<Link>(); Collection<Affordance> affordances = new ArrayList<Affordance>(); Collection<Link> templatedLinks = new ArrayList<Link>(); Collection<Affordance> templatedAffordances = new ArrayList<Affordance>(); for (Link link : links) { if (link instanceof Affordance) { final Affordance affordance = (Affordance) link; final List<ActionDescriptor> actionDescriptors = affordance.getActionDescriptors(); if (!actionDescriptors.isEmpty()) { if (affordance.isTemplated()) { templatedAffordances.add(affordance); } else { affordances.add(affordance); } } else { if (affordance.isTemplated()) { templatedLinks.add(affordance); } else { simpleLinks.add(affordance); } } } else if (link.isTemplated()) { templatedLinks.add(link); } else { simpleLinks.add(link); } } for (Affordance templatedAffordance : templatedAffordances) { jgen.writeObjectFieldStart(templatedAffordance.getRel()); jgen.writeStringField("@type", "hydra:IriTemplate"); jgen.writeStringField("hydra:template", templatedAffordance.getHref()); final List<ActionDescriptor> actionDescriptors = templatedAffordance.getActionDescriptors(); ActionDescriptor actionDescriptor = actionDescriptors.get(0); jgen.writeArrayFieldStart("hydra:mapping"); writeHydraVariableMapping(jgen, actionDescriptor, actionDescriptor.getPathVariableNames()); writeHydraVariableMapping(jgen, actionDescriptor, actionDescriptor.getRequestParamNames()); jgen.writeEndArray(); jgen.writeEndObject(); } for (Link templatedLink : templatedLinks) { // we only have the template, no access to method params jgen.writeObjectFieldStart(templatedLink.getRel()); jgen.writeStringField("@type", "hydra:IriTemplate"); jgen.writeStringField("hydra:template", templatedLink.getHref()); jgen.writeArrayFieldStart("hydra:mapping"); writeHydraVariableMapping(jgen, null, templatedLink.getVariableNames()); jgen.writeEndArray(); jgen.writeEndObject(); } Deque<String> vocabStack = (Deque<String>) serializerProvider .getAttribute(JacksonHydraSerializer.KEY_LD_CONTEXT); String currentVocab = vocabStack != null ? vocabStack.peek() : null; for (Affordance affordance : affordances) { final String rel = affordance.getRel(); List<ActionDescriptor> actionDescriptors = affordance.getActionDescriptors(); if (!actionDescriptors.isEmpty()) { if (!Link.REL_SELF.equals(rel)) { jgen.writeObjectFieldStart(rel); // begin rel } jgen.writeStringField(JacksonHydraSerializer.AT_ID, affordance.getHref()); jgen.writeArrayFieldStart("hydra:operation"); } for (ActionDescriptor actionDescriptor : actionDescriptors) { jgen.writeStartObject(); // begin a hydra:Operation final String semanticActionType = actionDescriptor.getSemanticActionType(); if (semanticActionType != null) { jgen.writeStringField("@type", semanticActionType); } jgen.writeStringField("hydra:method", actionDescriptor.getHttpMethod().name()); final ActionInputParameter requestBodyInputParameter = actionDescriptor.getRequestBody(); if (requestBodyInputParameter != null) { jgen.writeObjectFieldStart("hydra:expects"); // begin hydra:expects final Class<?> clazz = requestBodyInputParameter.getNestedParameterType(); final Expose classExpose = clazz.getAnnotation(Expose.class); final String typeName; if (classExpose != null) { typeName = classExpose.value(); } else { typeName = requestBodyInputParameter.getNestedParameterType().getSimpleName(); } jgen.writeStringField("@type", typeName); jgen.writeArrayFieldStart("hydra:supportedProperty"); // begin hydra:supportedProperty // TODO check need for actionDescriptor and requestBodyInputParameter here: recurseSupportedProperties(jgen, currentVocab, clazz, actionDescriptor, requestBodyInputParameter, requestBodyInputParameter.getCallValue()); jgen.writeEndArray(); // end hydra:supportedProperty jgen.writeEndObject(); // end hydra:expects } jgen.writeEndObject(); // end hydra:Operation } if (!actionDescriptors.isEmpty()) { jgen.writeEndArray(); // end hydra:operation if (!Link.REL_SELF.equals(rel)) { jgen.writeEndObject(); // end rel } } } for (Link simpleLink : simpleLinks) { final String rel = simpleLink.getRel(); if (Link.REL_SELF.equals(rel)) { jgen.writeStringField("@id", simpleLink.getHref()); } else { String linkAttributeName = IanaRels.isIanaRel(rel) ? IANA_REL_PREFIX + rel : rel; jgen.writeObjectFieldStart(linkAttributeName); jgen.writeStringField("@id", simpleLink.getHref()); jgen.writeEndObject(); } } } catch (IntrospectionException e) { throw new RuntimeException(e); } }
From source file:org.apache.olingo.server.core.serializer.json.ODataJsonSerializer.java
/** Writes a geospatial value following the GeoJSON specification defined in RFC 7946. */ protected void writeGeoValue(final String name, final EdmPrimitiveType type, final Geospatial geoValue, final Boolean isNullable, JsonGenerator json, SRID parentSrid) throws EdmPrimitiveTypeException, IOException, SerializerException { if (geoValue == null) { if (isNullable == null || isNullable) { json.writeNull();/* w w w . java 2 s .co m*/ } else { throw new EdmPrimitiveTypeException("The literal 'null' is not allowed."); } } else { if (!type.getDefaultType().isAssignableFrom(geoValue.getClass())) { throw new EdmPrimitiveTypeException("The value type " + geoValue.getClass() + " is not supported."); } json.writeStartObject(); json.writeStringField(Constants.ATTR_TYPE, geoValueTypeToJsonName.get(geoValue.getGeoType())); json.writeFieldName( geoValue.getGeoType() == Geospatial.Type.GEOSPATIALCOLLECTION ? Constants.JSON_GEOMETRIES : Constants.JSON_COORDINATES); json.writeStartArray(); switch (geoValue.getGeoType()) { case POINT: writeGeoPoint(json, (Point) geoValue); break; case MULTIPOINT: writeGeoPoints(json, (MultiPoint) geoValue); break; case LINESTRING: writeGeoPoints(json, (LineString) geoValue); break; case MULTILINESTRING: for (final LineString lineString : (MultiLineString) geoValue) { json.writeStartArray(); writeGeoPoints(json, lineString); json.writeEndArray(); } break; case POLYGON: writeGeoPolygon(json, (Polygon) geoValue); break; case MULTIPOLYGON: for (final Polygon polygon : (MultiPolygon) geoValue) { json.writeStartArray(); writeGeoPolygon(json, polygon); json.writeEndArray(); } break; case GEOSPATIALCOLLECTION: for (final Geospatial element : (GeospatialCollection) geoValue) { writeGeoValue(name, EdmPrimitiveTypeFactory.getInstance(element.getEdmPrimitiveTypeKind()), element, isNullable, json, geoValue.getSrid()); } break; } json.writeEndArray(); if (geoValue.getSrid() != null && geoValue.getSrid().isNotDefault() && (parentSrid == null || !parentSrid.equals(geoValue.getSrid()))) { srid(json, geoValue.getSrid()); } json.writeEndObject(); } }
From source file:org.apache.olingo.commons.core.serialization.JsonEntitySerializer.java
protected void doContainerSerialize(final ResWrap<Entity> container, final JsonGenerator jgen) throws IOException, EdmPrimitiveTypeException { final Entity entity = container.getPayload(); jgen.writeStartObject();/*from w ww .ja v a2 s.c om*/ if (serverMode) { if (container.getContextURL() != null) { jgen.writeStringField(version.compareTo(ODataServiceVersion.V40) >= 0 ? Constants.JSON_CONTEXT : Constants.JSON_METADATA, container.getContextURL().toASCIIString()); } if (version.compareTo(ODataServiceVersion.V40) >= 0 && StringUtils.isNotBlank(container.getMetadataETag())) { jgen.writeStringField(Constants.JSON_METADATA_ETAG, container.getMetadataETag()); } if (StringUtils.isNotBlank(entity.getETag())) { jgen.writeStringField(version.getJsonName(ODataServiceVersion.JsonKey.ETAG), entity.getETag()); } } if (StringUtils.isNotBlank(entity.getType())) { jgen.writeStringField(version.getJsonName(ODataServiceVersion.JsonKey.TYPE), new EdmTypeInfo.Builder().setTypeExpression(entity.getType()).build().external(version)); } if (entity.getId() != null) { jgen.writeStringField(version.getJsonName(ODataServiceVersion.JsonKey.ID), entity.getId().toASCIIString()); } for (Annotation annotation : entity.getAnnotations()) { valuable(jgen, annotation, "@" + annotation.getTerm()); } for (Property property : entity.getProperties()) { valuable(jgen, property, property.getName()); } if (serverMode && entity.getEditLink() != null && StringUtils.isNotBlank(entity.getEditLink().getHref())) { jgen.writeStringField(version.getJsonName(ODataServiceVersion.JsonKey.EDIT_LINK), entity.getEditLink().getHref()); if (entity.isMediaEntity()) { jgen.writeStringField(version.getJsonName(ODataServiceVersion.JsonKey.MEDIA_READ_LINK), entity.getEditLink().getHref() + "/$value"); } } links(entity, jgen); for (Link link : entity.getMediaEditLinks()) { if (link.getTitle() == null) { jgen.writeStringField(version.getJsonName(ODataServiceVersion.JsonKey.MEDIA_EDIT_LINK), link.getHref()); } if (link.getInlineEntity() != null) { jgen.writeObjectField(link.getTitle(), link.getInlineEntity()); } if (link.getInlineEntitySet() != null) { jgen.writeArrayFieldStart(link.getTitle()); for (Entity subEntry : link.getInlineEntitySet().getEntities()) { jgen.writeObject(subEntry); } jgen.writeEndArray(); } } if (serverMode) { for (ODataOperation operation : entity.getOperations()) { jgen.writeObjectFieldStart( "#" + StringUtils.substringAfterLast(operation.getMetadataAnchor(), "#")); jgen.writeStringField(Constants.ATTR_TITLE, operation.getTitle()); jgen.writeStringField(Constants.ATTR_TARGET, operation.getTarget().toASCIIString()); jgen.writeEndObject(); } } jgen.writeEndObject(); }
From source file:com.msopentech.odatajclient.engine.data.impl.JSONEntrySerializer.java
@Override protected void doSerialize(final AbstractJSONEntry entry, final JsonGenerator jgen, final SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeStartObject();/*from w w w . ja v a2 s. c o m*/ if (entry.getMetadata() != null) { jgen.writeStringField(ODataConstants.JSON_METADATA, entry.getMetadata().toASCIIString()); } if (StringUtils.isNotBlank(entry.getType())) { jgen.writeStringField(ODataConstants.JSON_TYPE, entry.getType()); } if (entry.getId() != null) { jgen.writeStringField(ODataConstants.JSON_ID, entry.getId()); } if (entry.getSelfLink() != null) { jgen.writeStringField(ODataConstants.JSON_READ_LINK, entry.getSelfLink().getHref()); } if (entry.getEditLink() != null) { jgen.writeStringField(ODataConstants.JSON_EDIT_LINK, entry.getEditLink().getHref()); } if (entry.getMediaContentSource() != null) { jgen.writeStringField(ODataConstants.JSON_MEDIAREAD_LINK, entry.getMediaContentSource()); } if (entry.getMediaContentType() != null) { jgen.writeStringField(ODataConstants.JSON_MEDIA_CONTENT_TYPE, entry.getMediaContentType()); } final Map<String, List<String>> entitySetLinks = new HashMap<String, List<String>>(); for (JSONLink link : entry.getNavigationLinks()) { if (link.getInlineEntry() != null) { jgen.writeObjectField(link.getTitle(), link.getInlineEntry()); } else if (link.getInlineFeed() != null) { jgen.writeObjectField(link.getTitle(), link.getInlineFeed()); } else { ODataLinkType type = null; try { type = ODataLinkType.fromString(client, link.getRel(), link.getType()); } catch (IllegalArgumentException e) { // ignore } if (type == ODataLinkType.ENTITY_SET_NAVIGATION) { final List<String> uris; if (entitySetLinks.containsKey(link.getTitle())) { uris = entitySetLinks.get(link.getTitle()); } else { uris = new ArrayList<String>(); entitySetLinks.put(link.getTitle(), uris); } uris.add(link.getHref()); } else { jgen.writeStringField(link.getTitle() + ODataConstants.JSON_BIND_LINK_SUFFIX, link.getHref()); } } } for (Map.Entry<String, List<String>> entitySetLink : entitySetLinks.entrySet()) { jgen.writeArrayFieldStart(entitySetLink.getKey() + ODataConstants.JSON_BIND_LINK_SUFFIX); for (String uri : entitySetLink.getValue()) { jgen.writeString(uri); } jgen.writeEndArray(); } for (JSONLink link : entry.getMediaEditLinks()) { if (link.getTitle() == null) { jgen.writeStringField(ODataConstants.JSON_MEDIAEDIT_LINK, link.getHref()); } if (link.getInlineEntry() != null) { jgen.writeObjectField(link.getTitle(), link.getInlineEntry()); } if (link.getInlineFeed() != null) { jgen.writeObjectField(link.getTitle(), link.getInlineFeed()); } } if (entry.getMediaEntryProperties() == null) { JSONDOMTreeUtils.writeSubtree(client, jgen, entry.getContent()); } else { JSONDOMTreeUtils.writeSubtree(client, jgen, entry.getMediaEntryProperties()); } jgen.writeEndObject(); }
From source file:com.msopentech.odatajclient.engine.data.json.JSONEntrySerializer.java
@Override protected void doSerializeV3(AbstractJSONEntry<AbstractLinkResource<?, ?>> entry, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeStartObject();//from w w w . j ava 2 s. c o m if (entry.getMetadata() != null) { jgen.writeStringField(ODataConstants.JSON_METADATA, entry.getMetadata().toASCIIString()); } if (StringUtils.isNotBlank(entry.getType())) { jgen.writeStringField(ODataConstants.JSON_TYPE, entry.getType()); } if (entry.getId() != null) { jgen.writeStringField(ODataConstants.JSON_ID, entry.getId()); } if (entry.getSelfLink() != null) { jgen.writeStringField(ODataConstants.JSON_READ_LINK, entry.getSelfLink().getHref()); } if (entry.getEditLink() != null) { jgen.writeStringField(ODataConstants.JSON_EDIT_LINK, entry.getEditLink().getHref()); } if (entry.getMediaContentSource() != null) { jgen.writeStringField(ODataConstants.JSON_MEDIAREAD_LINK, entry.getMediaContentSource()); } if (entry.getMediaContentType() != null) { jgen.writeStringField(ODataConstants.JSON_MEDIA_CONTENT_TYPE, entry.getMediaContentType()); } final Map<String, List<String>> entitySetLinks = new HashMap<String, List<String>>(); for (AbstractLinkResource link : (List<? extends AbstractLinkResource<?, ?>>) entry.getNavigationLinks()) { if (link.getInlineEntry() != null) { jgen.writeObjectField(link.getTitle(), link.getInlineEntry()); } else if (link.getInlineFeed() != null) { jgen.writeObjectField(link.getTitle(), link.getInlineFeed()); } else { ODataLinkType type = null; try { type = ODataLinkType.fromString(link.getRel(), link.getType()); } catch (IllegalArgumentException e) { // ignore } if (type == ODataLinkType.ENTITY_SET_NAVIGATION) { final List<String> uris; if (entitySetLinks.containsKey(link.getTitle())) { uris = entitySetLinks.get(link.getTitle()); } else { uris = new ArrayList<String>(); entitySetLinks.put(link.getTitle(), uris); } uris.add(link.getHref()); } else { jgen.writeStringField(link.getTitle() + ODataConstants.JSON_BIND_LINK_SUFFIX, link.getHref()); } } } for (Map.Entry<String, List<String>> entitySetLink : entitySetLinks.entrySet()) { jgen.writeArrayFieldStart(entitySetLink.getKey() + ODataConstants.JSON_BIND_LINK_SUFFIX); for (String uri : entitySetLink.getValue()) { jgen.writeString(uri); } jgen.writeEndArray(); } for (AbstractLinkResource link : (List<? extends AbstractLinkResource<?, ?>>) entry.getMediaEditLinks()) { if (link.getTitle() == null) { jgen.writeStringField(ODataConstants.JSON_MEDIAEDIT_LINK, link.getHref()); } if (link.getInlineEntry() != null) { jgen.writeObjectField(link.getTitle(), link.getInlineEntry()); } if (link.getInlineFeed() != null) { jgen.writeObjectField(link.getTitle(), link.getInlineFeed()); } } if (entry.getMediaEntryProperties() == null) { DOMTreeUtils.writeSubtree(client, jgen, entry.getContent()); } else { DOMTreeUtils.writeSubtree(client, jgen, entry.getMediaEntryProperties()); } jgen.writeEndObject(); }
From source file:org.apache.olingo.server.core.serializer.json.ODataJsonSerializer.java
private void writeComplexCollection(final ServiceMetadata metadata, final EdmComplexType type, final Property property, final Set<List<String>> selectedPaths, final JsonGenerator json, Set<List<String>> expandedPaths, Linked linked, ExpandOption expand) throws IOException, SerializerException { json.writeStartArray();//from ww w . ja v a2 s . c om EdmComplexType derivedType = type; Set<List<String>> expandedPaths1 = expandedPaths != null && !expandedPaths.isEmpty() ? expandedPaths : ExpandSelectHelper.getExpandedItemsPath(expand); for (Object value : property.asCollection()) { expandedPaths = expandedPaths1; derivedType = ((ComplexValue) value).getTypeName() != null ? metadata.getEdm().getComplexType(new FullQualifiedName(((ComplexValue) value).getTypeName())) : type; switch (property.getValueType()) { case COLLECTION_COMPLEX: json.writeStartObject(); if (isODataMetadataFull || (!isODataMetadataNone && !derivedType.equals(type))) { json.writeStringField(constants.getType(), "#" + derivedType.getFullQualifiedName().getFullQualifiedNameAsString()); } expandedPaths = expandedPaths == null || expandedPaths.isEmpty() ? null : ExpandSelectHelper.getReducedExpandItemsPaths(expandedPaths, property.getName()); writeComplexValue(metadata, derivedType, ((ComplexValue) value).getValue(), selectedPaths, json, expandedPaths, (ComplexValue) value, expand, property.getName()); json.writeEndObject(); break; default: throw new SerializerException("Property type not yet supported!", SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, property.getName()); } } json.writeEndArray(); }
From source file:com.streamsets.datacollector.http.JMXJsonServlet.java
private void listBeans(JsonGenerator jg, ObjectName qry, String attribute, HttpServletResponse response) throws IOException { Set<ObjectName> names = null; names = mBeanServer.queryNames(qry, null); jg.writeArrayFieldStart("beans"); Iterator<ObjectName> it = names.iterator(); while (it.hasNext()) { ObjectName oname = it.next(); MBeanInfo minfo;//from w w w .j a v a 2 s . com String code = ""; Object attributeinfo = null; try { minfo = mBeanServer.getMBeanInfo(oname); code = minfo.getClassName(); String prs = ""; try { if ("org.apache.commons.modeler.BaseModelMBean".equals(code)) { prs = "modelerType"; code = (String) mBeanServer.getAttribute(oname, prs); } if (attribute != null) { prs = attribute; attributeinfo = mBeanServer.getAttribute(oname, prs); } } catch (AttributeNotFoundException e) { // If the modelerType attribute was not found, the class name is used // instead. } catch (MBeanException e) { // The code inside the attribute getter threw an exception so // and fall back on the class name } catch (RuntimeException e) { // For some reason even with an MBeanException available to them // Runtime exceptionscan still find their way through, so treat them // the same as MBeanException } catch (ReflectionException e) { // This happens when the code inside the JMX bean (setter?? from the // java docs) threw an exception, so // class name } } catch (InstanceNotFoundException e) { //Ignored for some reason the bean was not found so don't output it continue; } catch (IntrospectionException e) { // This is an internal error, something odd happened with reflection so // continue; } catch (ReflectionException e) { // This happens when the code inside the JMX bean threw an exception, so // continue; } jg.writeStartObject(); jg.writeStringField("name", oname.toString()); jg.writeStringField("modelerType", code); if ((attribute != null) && (attributeinfo == null)) { jg.writeStringField("result", "ERROR"); jg.writeStringField("message", "No attribute with name " + attribute + " was found."); jg.writeEndObject(); jg.writeEndArray(); jg.close(); response.setStatus(HttpServletResponse.SC_NOT_FOUND); return; } if (attribute != null) { writeAttribute(jg, attribute, attributeinfo); } else { MBeanAttributeInfo attrs[] = minfo.getAttributes(); for (int i = 0; i < attrs.length; i++) { writeAttribute(jg, oname, attrs[i]); } } jg.writeEndObject(); } jg.writeEndArray(); }
From source file:com.msopentech.odatajclient.engine.data.json.JSONEntrySerializer.java
@Override protected void doSerializeV4(AbstractJSONEntry<AbstractLinkResource<?, ?>> entry, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { final String annotationPrefix = "@"; jgen.writeStartObject();//from ww w . j av a2 s .com if (entry.getMetadata() != null) { jgen.writeStringField(annotationPrefix + ODataConstants.JSON_METADATA, entry.getMetadata().toASCIIString()); } if (StringUtils.isNotBlank(entry.getType())) { jgen.writeStringField(annotationPrefix + ODataConstants.JSON_TYPE, entry.getType()); } if (entry.getId() != null) { jgen.writeStringField(annotationPrefix + ODataConstants.JSON_ID, entry.getId()); } if (entry.getSelfLink() != null) { jgen.writeStringField(annotationPrefix + ODataConstants.JSON_READ_LINK, entry.getSelfLink().getHref()); } if (entry.getEditLink() != null) { jgen.writeStringField(annotationPrefix + ODataConstants.JSON_EDIT_LINK, entry.getEditLink().getHref()); } if (entry.getMediaContentSource() != null) { jgen.writeStringField(annotationPrefix + ODataConstants.JSON_MEDIAREAD_LINK, entry.getMediaContentSource()); } if (entry.getMediaContentType() != null) { jgen.writeStringField(annotationPrefix + ODataConstants.JSON_MEDIA_CONTENT_TYPE, entry.getMediaContentType()); } final Map<String, List<String>> entitySetLinks = new HashMap<String, List<String>>(); for (AbstractLinkResource link : (List<? extends AbstractLinkResource<?, ?>>) entry.getNavigationLinks()) { if (link.getInlineEntry() != null) { jgen.writeObjectField(link.getTitle(), link.getInlineEntry()); } else if (link.getInlineFeed() != null) { jgen.writeObjectField(link.getTitle(), link.getInlineFeed()); } else { ODataLinkType type = null; try { type = ODataLinkType.fromString(link.getRel(), link.getType()); } catch (IllegalArgumentException e) { // ignore } if (type == ODataLinkType.ENTITY_SET_NAVIGATION) { final List<String> uris; if (entitySetLinks.containsKey(link.getTitle())) { uris = entitySetLinks.get(link.getTitle()); } else { uris = new ArrayList<String>(); entitySetLinks.put(link.getTitle(), uris); } uris.add(link.getHref()); } else { jgen.writeStringField(link.getTitle() + ODataConstants.JSON_BIND_LINK_SUFFIX, link.getHref()); } } } for (Map.Entry<String, List<String>> entitySetLink : entitySetLinks.entrySet()) { jgen.writeArrayFieldStart(entitySetLink.getKey() + ODataConstants.JSON_BIND_LINK_SUFFIX); for (String uri : entitySetLink.getValue()) { jgen.writeString(uri); } jgen.writeEndArray(); } for (AbstractLinkResource link : (List<? extends AbstractLinkResource<?, ?>>) entry.getMediaEditLinks()) { if (link.getTitle() == null) { jgen.writeStringField(annotationPrefix + ODataConstants.JSON_MEDIAEDIT_LINK, link.getHref()); } if (link.getInlineEntry() != null) { jgen.writeObjectField(link.getTitle(), link.getInlineEntry()); } if (link.getInlineFeed() != null) { jgen.writeObjectField(link.getTitle(), link.getInlineFeed()); } } if (entry.getMediaEntryProperties() == null) { DOMTreeUtils.writeSubtree(client, jgen, entry.getContent()); } else { DOMTreeUtils.writeSubtree(client, jgen, entry.getMediaEntryProperties()); } jgen.writeEndObject(); }