public KeySchemaElement unmarshall(JsonUnmarshallerContext context) throws Exception { KeySchemaElement keySchemaElement = new KeySchemaElement(); AwsJsonReader reader = context.getReader(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("AttributeName")) { keySchemaElement.setAttributeName(StringJsonUnmarshaller.getInstance().unmarshall(context)); } else if (name.equals("KeyType")) { keySchemaElement.setKeyType(StringJsonUnmarshaller.getInstance().unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return keySchemaElement; }
/** Marshall the given parameter object, and output to a JSONWriter */ public void marshall(KeySchemaElement keySchemaElement, JSONWriter jsonWriter) { if (keySchemaElement == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonWriter.object(); if (keySchemaElement.getAttributeName() != null) { jsonWriter.key("AttributeName").value(keySchemaElement.getAttributeName()); } if (keySchemaElement.getKeyType() != null) { jsonWriter.key("KeyType").value(keySchemaElement.getKeyType()); } jsonWriter.endObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }