-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
code generation wrappers refactoring and protocol test clients genera…
…tion
- Loading branch information
1 parent
782242a
commit c21f620
Showing
10 changed files
with
824 additions
and
531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...a/com/amazonaws/util/awsclientgenerator/domainmodels/c2j/C2jXmlNamespaceDeserializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
package com.amazonaws.util.awsclientgenerator.domainmodels.c2j; | ||
|
||
|
||
import com.google.gson.JsonDeserializationContext; | ||
import com.google.gson.JsonDeserializer; | ||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonObject; | ||
import com.google.gson.JsonParseException; | ||
import com.google.gson.JsonPrimitive; | ||
|
||
import java.lang.reflect.Type; | ||
|
||
public class C2jXmlNamespaceDeserializer implements JsonDeserializer<C2jXmlNamespace> { | ||
|
||
@Override | ||
public C2jXmlNamespace deserialize(JsonElement jsonElement, Type type, | ||
JsonDeserializationContext context) throws JsonParseException { | ||
C2jXmlNamespace retValue = new C2jXmlNamespace(); | ||
|
||
if (jsonElement.isJsonObject()) { | ||
JsonObject jsonObject = jsonElement.getAsJsonObject(); | ||
if (jsonObject.has("uri")) { | ||
JsonPrimitive uriPrimitive = jsonObject.getAsJsonPrimitive("uri"); | ||
if (!uriPrimitive.isString()) { | ||
throw new JsonParseException("Unexpected C2jXmlNamespace.uri type, expected a String!"); | ||
} | ||
retValue.setUri(uriPrimitive.getAsString()); | ||
} | ||
if (jsonObject.has("prefix")) { | ||
JsonPrimitive prefixPrimitive = jsonObject.getAsJsonPrimitive("prefix"); | ||
if (!prefixPrimitive.isString()) { | ||
throw new JsonParseException("Unexpected C2jXmlNamespace.prefix type, expected a String!"); | ||
} | ||
retValue.setPrefix(prefixPrimitive.getAsString()); | ||
} | ||
} else if (jsonElement.isJsonPrimitive() && jsonElement.getAsJsonPrimitive().isString()) { | ||
retValue.setUri(jsonElement.getAsJsonPrimitive().getAsString()); | ||
} else { | ||
throw new JsonParseException("Unexpected C2jXmlNamespace value, expected primitive Object or Primitive!"); | ||
} | ||
|
||
return retValue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0. |
Oops, something went wrong.