public Request<UpdateByteMatchSetRequest> marshall( UpdateByteMatchSetRequest updateByteMatchSetRequest) { if (updateByteMatchSetRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<UpdateByteMatchSetRequest> request = new DefaultRequest<UpdateByteMatchSetRequest>(updateByteMatchSetRequest, "AWSWAF"); request.addHeader("X-Amz-Target", "AWSWAF_20150824.UpdateByteMatchSet"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (updateByteMatchSetRequest.getByteMatchSetId() != null) { jsonGenerator .writeFieldName("ByteMatchSetId") .writeValue(updateByteMatchSetRequest.getByteMatchSetId()); } if (updateByteMatchSetRequest.getChangeToken() != null) { jsonGenerator .writeFieldName("ChangeToken") .writeValue(updateByteMatchSetRequest.getChangeToken()); } java.util.List<ByteMatchSetUpdate> updatesList = updateByteMatchSetRequest.getUpdates(); if (updatesList != null) { jsonGenerator.writeFieldName("Updates"); jsonGenerator.writeStartArray(); for (ByteMatchSetUpdate updatesListValue : updatesList) { if (updatesListValue != null) { ByteMatchSetUpdateJsonMarshaller.getInstance() .marshall(updatesListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); request.addHeader("Content-Length", Integer.toString(content.length)); request.addHeader("Content-Type", protocolFactory.getContentType()); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof UpdateByteMatchSetRequest == false) return false; UpdateByteMatchSetRequest other = (UpdateByteMatchSetRequest) obj; if (other.getByteMatchSetId() == null ^ this.getByteMatchSetId() == null) return false; if (other.getByteMatchSetId() != null && other.getByteMatchSetId().equals(this.getByteMatchSetId()) == false) return false; if (other.getChangeToken() == null ^ this.getChangeToken() == null) return false; if (other.getChangeToken() != null && other.getChangeToken().equals(this.getChangeToken()) == false) return false; if (other.getUpdates() == null ^ this.getUpdates() == null) return false; if (other.getUpdates() != null && other.getUpdates().equals(this.getUpdates()) == false) return false; return true; }