[OLINGO-406] Omit odata.type information for none metadata

This commit is contained in:
mibo 2014-09-01 08:27:07 +02:00
parent b81a2ee4fc
commit deec7aa854
2 changed files with 3 additions and 3 deletions

View File

@ -74,7 +74,7 @@ public class JsonEntitySerializer extends JsonSerializer {
}
}
if (StringUtils.isNotBlank(entity.getType()) && format == ODataFormat.JSON_FULL_METADATA) {
if (StringUtils.isNotBlank(entity.getType()) && format != ODataFormat.JSON_NO_METADATA) {
jgen.writeStringField(version.getJsonName(ODataServiceVersion.JsonKey.TYPE),
new EdmTypeInfo.Builder().setTypeExpression(entity.getType()).build().external(version));
}

View File

@ -314,7 +314,7 @@ public class JsonSerializer implements ODataSerializer {
throws IOException, EdmPrimitiveTypeException {
jgen.writeStartObject();
if (typeInfo != null && format == ODataFormat.JSON_FULL_METADATA) {
if (typeInfo != null && format != ODataFormat.JSON_NO_METADATA) {
jgen.writeStringField(version.getJsonName(ODataServiceVersion.JsonKey.TYPE), typeInfo.external(version));
}
@ -361,7 +361,7 @@ public class JsonSerializer implements ODataSerializer {
if (StringUtils.isBlank(type) && valuable.isPrimitive() || valuable.isNull()) {
type = EdmPrimitiveTypeKind.String.getFullQualifiedName().toString();
}
if (StringUtils.isNotBlank(type) && format == ODataFormat.JSON_FULL_METADATA) {
if (StringUtils.isNotBlank(type) && format != ODataFormat.JSON_NO_METADATA) {
jgen.writeFieldName(
name + StringUtils.prependIfMissing(version.getJsonName(ODataServiceVersion.JsonKey.TYPE), "@"));
jgen.writeString(new EdmTypeInfo.Builder().setTypeExpression(type).build().external(version));