mirror of
https://github.com/apache/olingo-odata4.git
synced 2025-02-11 04:26:16 +00:00
[OLINGO-935] resolve checkstyle issue
This commit is contained in:
parent
bc61da3dfd
commit
22a21a28ea
@ -80,15 +80,13 @@ public class EdmAssistedJsonSerializer {
|
|||||||
return serialize(metadata, entityType, entity, contextURL);
|
return serialize(metadata, entityType, entity, contextURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SerializerResult serialize(final ServiceMetadata metadata, final EdmEntityType entityType, final AbstractODataObject obj,
|
protected SerializerResult serialize(final ServiceMetadata metadata, final EdmEntityType entityType,
|
||||||
final ContextURL contextURL) throws SerializerException {
|
final AbstractODataObject obj, final ContextURL contextURL) throws SerializerException {
|
||||||
final String metadataETag =
|
final String metadataETag =
|
||||||
isODataMetadataNone || metadata == null || metadata.getServiceMetadataETagSupport() == null ?
|
isODataMetadataNone || metadata == null || metadata.getServiceMetadataETagSupport() == null ? null : metadata
|
||||||
null :
|
.getServiceMetadataETagSupport().getMetadataETag();
|
||||||
metadata.getServiceMetadataETagSupport().getMetadataETag();
|
final String contextURLString = isODataMetadataNone || contextURL == null ? null : ContextURLBuilder.create(
|
||||||
final String contextURLString = isODataMetadataNone || contextURL == null ?
|
contextURL).toASCIIString();
|
||||||
null :
|
|
||||||
ContextURLBuilder.create(contextURL).toASCIIString();
|
|
||||||
OutputStream outputStream = null;
|
OutputStream outputStream = null;
|
||||||
SerializerException cachedException = null;
|
SerializerException cachedException = null;
|
||||||
try {
|
try {
|
||||||
@ -114,9 +112,8 @@ public class EdmAssistedJsonSerializer {
|
|||||||
try {
|
try {
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw cachedException == null ?
|
throw cachedException == null ? new SerializerException(IO_EXCEPTION_TEXT, e,
|
||||||
new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION) :
|
SerializerException.MessageKeys.IO_EXCEPTION) : cachedException;
|
||||||
cachedException;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,9 +161,8 @@ public class EdmAssistedJsonSerializer {
|
|||||||
|
|
||||||
json.writeStartObject();
|
json.writeStartObject();
|
||||||
|
|
||||||
final String typeName = entity.getType() == null ?
|
final String typeName = entity.getType() == null ? null : new EdmTypeInfo.Builder().setTypeExpression(entity
|
||||||
null :
|
.getType()).build().external();
|
||||||
new EdmTypeInfo.Builder().setTypeExpression(entity.getType()).build().external();
|
|
||||||
metadata(contextURLString, metadataETag, entity.getETag(), typeName, entity.getId(), true, json);
|
metadata(contextURLString, metadataETag, entity.getETag(), typeName, entity.getId(), true, json);
|
||||||
|
|
||||||
for (final Annotation annotation : entity.getAnnotations()) {
|
for (final Annotation annotation : entity.getAnnotations()) {
|
||||||
@ -175,9 +171,8 @@ public class EdmAssistedJsonSerializer {
|
|||||||
|
|
||||||
for (final Property property : entity.getProperties()) {
|
for (final Property property : entity.getProperties()) {
|
||||||
final String name = property.getName();
|
final String name = property.getName();
|
||||||
final EdmProperty edmProperty = entityType == null || entityType.getStructuralProperty(name) == null ?
|
final EdmProperty edmProperty = entityType == null || entityType.getStructuralProperty(name) == null ? null
|
||||||
null :
|
: entityType.getStructuralProperty(name);
|
||||||
entityType.getStructuralProperty(name);
|
|
||||||
valuable(json, property, name, edmProperty == null ? null : edmProperty.getType(), edmProperty);
|
valuable(json, property, name, edmProperty == null ? null : edmProperty.getType(), edmProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,9 +227,8 @@ public class EdmAssistedJsonSerializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final EdmEntityType targetType =
|
final EdmEntityType targetType =
|
||||||
entityType == null || name == null || entityType.getNavigationProperty(name) == null ?
|
entityType == null || name == null || entityType.getNavigationProperty(name) == null ? null : entityType
|
||||||
null :
|
.getNavigationProperty(name).getType();
|
||||||
entityType.getNavigationProperty(name).getType();
|
|
||||||
if (link.getInlineEntity() != null) {
|
if (link.getInlineEntity() != null) {
|
||||||
json.writeFieldName(name);
|
json.writeFieldName(name);
|
||||||
doSerialize(targetType, link.getInlineEntity(), null, null, json);
|
doSerialize(targetType, link.getInlineEntity(), null, null, json);
|
||||||
@ -281,9 +275,8 @@ public class EdmAssistedJsonSerializer {
|
|||||||
EdmPrimitiveType type = valueType;
|
EdmPrimitiveType type = valueType;
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
final EdmPrimitiveTypeKind kind =
|
final EdmPrimitiveTypeKind kind =
|
||||||
typeName == null ?
|
typeName == null ? EdmTypeInfo.determineTypeKind(value) : new EdmTypeInfo.Builder().setTypeExpression(
|
||||||
EdmTypeInfo.determineTypeKind(value) :
|
typeName).build().getPrimitiveTypeKind();
|
||||||
new EdmTypeInfo.Builder().setTypeExpression(typeName).build().getPrimitiveTypeKind();
|
|
||||||
type = kind == null ? null : EdmPrimitiveTypeFactory.getInstance(kind);
|
type = kind == null ? null : EdmPrimitiveTypeFactory.getInstance(kind);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,13 +305,13 @@ public class EdmAssistedJsonSerializer {
|
|||||||
(type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64)
|
(type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64)
|
||||||
|| type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal))
|
|| type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal))
|
||||||
|| type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte)
|
|| type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte)
|
||||||
&& type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte)
|
&& type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte)
|
||||||
&& type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single)
|
&& type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single)
|
||||||
&& type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double)
|
&& type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double)
|
||||||
&& type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16)
|
&& type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16)
|
||||||
&& type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32)
|
&& type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32)
|
||||||
&& type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64)
|
&& type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64)
|
||||||
&& type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal)) {
|
&& type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal)) {
|
||||||
json.writeString(serialized);
|
json.writeString(serialized);
|
||||||
} else {
|
} else {
|
||||||
json.writeNumber(serialized);
|
json.writeNumber(serialized);
|
||||||
@ -336,9 +329,8 @@ public class EdmAssistedJsonSerializer {
|
|||||||
|
|
||||||
for (final Property property : value.getValue()) {
|
for (final Property property : value.getValue()) {
|
||||||
final String name = property.getName();
|
final String name = property.getName();
|
||||||
final EdmProperty edmProperty = valueType == null || valueType.getStructuralProperty(name) == null ?
|
final EdmProperty edmProperty = valueType == null || valueType.getStructuralProperty(name) == null ? null
|
||||||
null :
|
: valueType.getStructuralProperty(name);
|
||||||
valueType.getStructuralProperty(name);
|
|
||||||
valuable(json, property, name, edmProperty == null ? null : edmProperty.getType(), edmProperty);
|
valuable(json, property, name, edmProperty == null ? null : edmProperty.getType(), edmProperty);
|
||||||
}
|
}
|
||||||
links(value, null, json);
|
links(value, null, json);
|
||||||
@ -348,9 +340,8 @@ public class EdmAssistedJsonSerializer {
|
|||||||
|
|
||||||
private void value(final JsonGenerator json, final Valuable value, final EdmType type, final EdmProperty edmProperty)
|
private void value(final JsonGenerator json, final Valuable value, final EdmType type, final EdmProperty edmProperty)
|
||||||
throws IOException, SerializerException {
|
throws IOException, SerializerException {
|
||||||
final String typeName = value.getType() == null ?
|
final String typeName = value.getType() == null ? null : new EdmTypeInfo.Builder().setTypeExpression(value
|
||||||
null :
|
.getType()).build().external();
|
||||||
new EdmTypeInfo.Builder().setTypeExpression(value.getType()).build().external();
|
|
||||||
|
|
||||||
if (value.isNull()) {
|
if (value.isNull()) {
|
||||||
json.writeNull();
|
json.writeNull();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user