/** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(EventDetails eventDetails, StructuredJsonGenerator jsonGenerator) {

    if (eventDetails == null) {
      throw new SdkClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonGenerator.writeStartObject();

      if (eventDetails.getEvent() != null) {
        jsonGenerator.writeFieldName("event");
        EventJsonMarshaller.getInstance().marshall(eventDetails.getEvent(), jsonGenerator);
      }
      if (eventDetails.getEventDescription() != null) {
        jsonGenerator.writeFieldName("eventDescription");
        EventDescriptionJsonMarshaller.getInstance()
            .marshall(eventDetails.getEventDescription(), jsonGenerator);
      }

      java.util.Map<String, String> eventMetadataMap = eventDetails.getEventMetadata();
      if (eventMetadataMap != null) {
        jsonGenerator.writeFieldName("eventMetadata");
        jsonGenerator.writeStartObject();

        for (Map.Entry<String, String> eventMetadataMapValue : eventMetadataMap.entrySet()) {
          if (eventMetadataMapValue.getValue() != null) {
            jsonGenerator.writeFieldName(eventMetadataMapValue.getKey());

            jsonGenerator.writeValue(eventMetadataMapValue.getValue());
          }
        }
        jsonGenerator.writeEndObject();
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
Exemplo n.º 2
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof EventDetails == false) return false;
    EventDetails other = (EventDetails) obj;
    if (other.getEvent() == null ^ this.getEvent() == null) return false;
    if (other.getEvent() != null && other.getEvent().equals(this.getEvent()) == false) return false;
    if (other.getEventDescription() == null ^ this.getEventDescription() == null) return false;
    if (other.getEventDescription() != null
        && other.getEventDescription().equals(this.getEventDescription()) == false) return false;
    if (other.getEventMetadata() == null ^ this.getEventMetadata() == null) return false;
    if (other.getEventMetadata() != null
        && other.getEventMetadata().equals(this.getEventMetadata()) == false) return false;
    return true;
  }