EdmProperty property = type.getStructuralProperty(key); value = EdmPrimitiveTypeFactory.getInstance(kind) .valueToString(propertyValue, property.isNullable(), property.getMaxLength(),
protected void doSerialize(final EdmEntityType entityType, final Entity entity, final String contextURLString, final String metadataETag, JsonGenerator json) throws IOException, SerializerException { json.writeStartObject(); final String typeName = entity.getType() == null ? null : new EdmTypeInfo.Builder().setTypeExpression(entity .getType()).build().external(); metadata(contextURLString, metadataETag, entity.getETag(), typeName, entity.getId(), true, json); for (final Annotation annotation : entity.getAnnotations()) { valuable(json, annotation, '@' + annotation.getTerm(), null, null); } for (final Property property : entity.getProperties()) { final String name = property.getName(); final EdmProperty edmProperty = entityType == null || entityType.getStructuralProperty(name) == null ? null : entityType.getStructuralProperty(name); valuable(json, property, name, edmProperty == null ? null : edmProperty.getType(), edmProperty); } if (!isODataMetadataNone && entity.getEditLink() != null && entity.getEditLink().getHref() != null) { json.writeStringField(Constants.JSON_EDIT_LINK, entity.getEditLink().getHref()); if (entity.isMediaEntity()) { json.writeStringField(Constants.JSON_MEDIA_READ_LINK, entity.getEditLink().getHref() + "/$value"); } } links(entity, entityType, json); json.writeEndObject(); }
protected void doSerialize(final EdmEntityType entityType, final Entity entity, final String contextURLString, final String metadataETag, JsonGenerator json) throws IOException, SerializerException { json.writeStartObject(); final String typeName = entity.getType() == null ? null : new EdmTypeInfo.Builder().setTypeExpression(entity .getType()).build().external(); metadata(contextURLString, metadataETag, entity.getETag(), typeName, entity.getId(), true, json); for (final Annotation annotation : entity.getAnnotations()) { valuable(json, annotation, '@' + annotation.getTerm(), null, null); } for (final Property property : entity.getProperties()) { final String name = property.getName(); final EdmProperty edmProperty = entityType == null || entityType.getStructuralProperty(name) == null ? null : entityType.getStructuralProperty(name); valuable(json, property, name, edmProperty == null ? null : edmProperty.getType(), edmProperty); } if (!isODataMetadataNone && entity.getEditLink() != null && entity.getEditLink().getHref() != null) { json.writeStringField(Constants.JSON_EDIT_LINK, entity.getEditLink().getHref()); if (entity.isMediaEntity()) { json.writeStringField(Constants.JSON_MEDIA_READ_LINK, entity.getEditLink().getHref() + "/$value"); } } links(entity, entityType, json); json.writeEndObject(); }
readPrimitiveValueInString(entityType.getStructuralProperty(property.getName()), property.getValue()));
readPrimitiveValueInString(entityType.getStructuralProperty(property.getName()), property.getValue()));
if (property == null) { if (getAlias() == null) { property = edmEntityType.getStructuralProperty(getName()); if (property == null) { throw new EdmException("Invalid key property ref specified. Can´t find property with name: "
if (property == null) { if (getAlias() == null) { property = edmEntityType.getStructuralProperty(getName()); if (property == null) { throw new EdmException("Invalid key property ref specified. Can´t find property with name: "