Repository navigation
Consolidate unmarshalling and parsing in a single pass #5643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
99923f8
24a07e7
b33fa34
1b93fce
0bbb748
a412be7
6cfadea
8d49614
ab45d70
67f531a
99f0009
384ff36
138b13a
0db0e56
e3280fb
ff1d00a
3dd9420
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "category": "AWS SDK for Java v2", | ||
| "contributor": "", | ||
| "type": "feature", | ||
| "description": "Improve unmarshalling performance of all JSON protocols by unifying parsing with unmarshalling instead of doing one after the other." | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| import java.util.Arrays; | ||
| import java.util.Collection; | ||
| import java.util.Collections; | ||
| import java.util.HashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Objects; | ||
|
|
@@ -450,6 +451,48 @@ SdkField.<SdkBytes> builder(MarshallingType.SDK_BYTES) | |
| POLYMORPHIC_TYPE_WITHOUT_SUB_TYPES_FIELD, ENUM_TYPE_FIELD, UNDERSCORE_NAME_TYPE_FIELD, MY_DOCUMENT_FIELD, | ||
| ALL_TYPES_UNION_STRUCTURE_FIELD)); | ||
|
|
||
| private static final Map<String, SdkField<?>> SDK_NAME_TO_FIELD = Collections | ||
| .unmodifiableMap(new HashMap<String, SdkField<?>>() { | ||
| { | ||
| put("StringMember", STRING_MEMBER_FIELD); | ||
| put("IntegerMember", INTEGER_MEMBER_FIELD); | ||
| put("BooleanMember", BOOLEAN_MEMBER_FIELD); | ||
| put("FloatMember", FLOAT_MEMBER_FIELD); | ||
| put("DoubleMember", DOUBLE_MEMBER_FIELD); | ||
| put("LongMember", LONG_MEMBER_FIELD); | ||
| put("ShortMember", SHORT_MEMBER_FIELD); | ||
| put("ByteMember", BYTE_MEMBER_FIELD); | ||
| put("SimpleList", SIMPLE_LIST_FIELD); | ||
| put("ListOfEnums", LIST_OF_ENUMS_FIELD); | ||
| put("ListOfMaps", LIST_OF_MAPS_FIELD); | ||
| put("ListOfStructs", LIST_OF_STRUCTS_FIELD); | ||
| put("ListOfMapOfEnumToString", LIST_OF_MAP_OF_ENUM_TO_STRING_FIELD); | ||
| put("ListOfMapOfStringToStruct", LIST_OF_MAP_OF_STRING_TO_STRUCT_FIELD); | ||
| put("MapOfStringToIntegerList", MAP_OF_STRING_TO_INTEGER_LIST_FIELD); | ||
| put("MapOfStringToString", MAP_OF_STRING_TO_STRING_FIELD); | ||
| put("MapOfStringToSimpleStruct", MAP_OF_STRING_TO_SIMPLE_STRUCT_FIELD); | ||
| put("MapOfEnumToEnum", MAP_OF_ENUM_TO_ENUM_FIELD); | ||
| put("MapOfEnumToString", MAP_OF_ENUM_TO_STRING_FIELD); | ||
| put("MapOfStringToEnum", MAP_OF_STRING_TO_ENUM_FIELD); | ||
| put("MapOfEnumToSimpleStruct", MAP_OF_ENUM_TO_SIMPLE_STRUCT_FIELD); | ||
| put("MapOfEnumToListOfEnums", MAP_OF_ENUM_TO_LIST_OF_ENUMS_FIELD); | ||
| put("MapOfEnumToMapOfStringToEnum", MAP_OF_ENUM_TO_MAP_OF_STRING_TO_ENUM_FIELD); | ||
| put("TimestampMember", TIMESTAMP_MEMBER_FIELD); | ||
| put("StructWithNestedTimestampMember", STRUCT_WITH_NESTED_TIMESTAMP_MEMBER_FIELD); | ||
| put("BlobArg", BLOB_ARG_FIELD); | ||
| put("StructWithNestedBlob", STRUCT_WITH_NESTED_BLOB_FIELD); | ||
| put("BlobMap", BLOB_MAP_FIELD); | ||
| put("ListOfBlobs", LIST_OF_BLOBS_FIELD); | ||
| put("RecursiveStruct", RECURSIVE_STRUCT_FIELD); | ||
| put("PolymorphicTypeWithSubTypes", POLYMORPHIC_TYPE_WITH_SUB_TYPES_FIELD); | ||
| put("PolymorphicTypeWithoutSubTypes", POLYMORPHIC_TYPE_WITHOUT_SUB_TYPES_FIELD); | ||
| put("EnumType", ENUM_TYPE_FIELD); | ||
| put("Underscore_Name_Type", UNDERSCORE_NAME_TYPE_FIELD); | ||
| put("MyDocument", MY_DOCUMENT_FIELD); | ||
| put("AllTypesUnionStructure", ALL_TYPES_UNION_STRUCTURE_FIELD); | ||
| } | ||
| }); | ||
|
|
||
| private final String stringMember; | ||
|
|
||
| private final Integer integerMember; | ||
|
|
@@ -1604,6 +1647,11 @@ public final List<SdkField<?>> sdkFields() { | |
| return SDK_FIELDS; | ||
| } | ||
|
|
||
| @Override | ||
| public final Map<String, SdkField<?>> sdkFieldNameToField() { | ||
| return SDK_NAME_TO_FIELD; | ||
| } | ||
|
|
||
| private static <T> Function<Object, T> getter(Function<AllTypesRequest, T> g) { | ||
| return obj -> g.apply((AllTypesRequest) obj); | ||
| } | ||
|
|
@@ -3065,5 +3113,10 @@ public AllTypesRequest build() { | |
| public List<SdkField<?>> sdkFields() { | ||
| return SDK_FIELDS; | ||
| } | ||
|
|
||
| @Override | ||
| public Map<String, SdkField<?>> sdkFieldNameToField() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it need to return a collection? Doesn't seem like we use any of the collection functionality anywhere. Can we just have a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this method has to return a map as defined in the |
||
| return SDK_NAME_TO_FIELD; | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.