Skip to content

Commit 4264bee

Browse files
committed
- simplifies collection naviagation properties parsing through serializer
1 parent aff5f4a commit 4264bee

File tree

1 file changed

+2
-29
lines changed

1 file changed

+2
-29
lines changed

src/GraphODataTemplateWriter/CodeHelpers/Java/TypeHelperJava.cs

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,6 @@ public static string CreatePackageDefForEntity(this CustomT4Host host)
10451045
sb.AppendFormat(@"import {0}.serializer.ISerializer;
10461046
import {0}.serializer.IJsonBackedObject;
10471047
import {0}.serializer.AdditionalDataManager;
1048-
import java.util.Arrays;
10491048
import java.util.EnumSet;", host.CurrentModel.GetNamespace().AddPrefix());
10501049

10511050
sb.Append("\n");
@@ -1129,18 +1128,6 @@ public static string CreatePackageDefForEntity(this CustomT4Host host)
11291128
if (property.Type is OdcmPrimitiveType)
11301129
continue;
11311130

1132-
var propertyType = TypeCollectionResponse(property);
1133-
string importstr = String.Format(importFormat,
1134-
property.Projection.Type.Namespace.Name.AddPrefix(),
1135-
GetPrefixForRequests(),
1136-
propertyType);
1137-
if (!uniqueStore.ContainsKey(importstr))
1138-
{
1139-
uniqueStore.Add(importstr, 0);
1140-
sb.Append(importstr);
1141-
sb.Append("\n");
1142-
}
1143-
11441131
string propertyValue = TypeCollectionPage(property);
11451132
string importstr1 = String.Format(importFormat,
11461133
property.Projection.Type.Namespace.Name.AddPrefix(),
@@ -1354,25 +1341,11 @@ public static string UpdatePropertiesWithinSetRawObject(IEnumerable<OdcmProperty
13541341
sb.AppendFormat(
13551342
@"
13561343
if (json.has(""{0}"")) {{
1357-
final {1} response = new {1}();
1358-
if (json.has(""{0}@odata.nextLink"")) {{
1359-
response.nextLink = json.get(""{0}@odata.nextLink"").getAsString();
1360-
}}
1361-
1362-
final JsonObject[] sourceArray = serializer.deserializeObject(json.get(""{0}"").toString(), JsonObject[].class);
1363-
final {3}[] array = new {3}[sourceArray.length];
1364-
for (int i = 0; i < sourceArray.length; i++) {{
1365-
array[i] = serializer.deserializeObject(sourceArray[i].toString(), {3}.class);
1366-
array[i].setRawObject(serializer, sourceArray[i]);
1367-
}}
1368-
response.value = Arrays.asList(array);
1369-
{0} = new {2}(response, null);
1344+
{0} = serializer.deserializeObject(json.get(""{0}"").toString(), {1}.class);
13701345
}}
13711346
",
13721347
property.Name.SanitizePropertyName(property),
1373-
TypeCollectionResponse(property),
1374-
TypeCollectionPage(property),
1375-
property.GetTypeString());
1348+
TypeCollectionPage(property));
13761349
}
13771350
}
13781351
sb.Append(" }");

0 commit comments

Comments
 (0)