Ejemplo n.º 1
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof Rule == false) return false;
    Rule other = (Rule) obj;
    if (other.getName() == null ^ this.getName() == null) return false;
    if (other.getName() != null && other.getName().equals(this.getName()) == false) return false;
    if (other.getArn() == null ^ this.getArn() == null) return false;
    if (other.getArn() != null && other.getArn().equals(this.getArn()) == false) return false;
    if (other.getEventPattern() == null ^ this.getEventPattern() == null) return false;
    if (other.getEventPattern() != null
        && other.getEventPattern().equals(this.getEventPattern()) == false) return false;
    if (other.getState() == null ^ this.getState() == null) return false;
    if (other.getState() != null && other.getState().equals(this.getState()) == false) return false;
    if (other.getDescription() == null ^ this.getDescription() == null) return false;
    if (other.getDescription() != null
        && other.getDescription().equals(this.getDescription()) == false) return false;
    if (other.getScheduleExpression() == null ^ this.getScheduleExpression() == null) return false;
    if (other.getScheduleExpression() != null
        && other.getScheduleExpression().equals(this.getScheduleExpression()) == false)
      return false;
    if (other.getRoleArn() == null ^ this.getRoleArn() == null) return false;
    if (other.getRoleArn() != null && other.getRoleArn().equals(this.getRoleArn()) == false)
      return false;
    return true;
  }
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(Rule rule, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (rule.getName() != null) {
        jsonGenerator.writeFieldName("Name").writeValue(rule.getName());
      }
      if (rule.getArn() != null) {
        jsonGenerator.writeFieldName("Arn").writeValue(rule.getArn());
      }
      if (rule.getEventPattern() != null) {
        jsonGenerator.writeFieldName("EventPattern").writeValue(rule.getEventPattern());
      }
      if (rule.getState() != null) {
        jsonGenerator.writeFieldName("State").writeValue(rule.getState());
      }
      if (rule.getDescription() != null) {
        jsonGenerator.writeFieldName("Description").writeValue(rule.getDescription());
      }
      if (rule.getScheduleExpression() != null) {
        jsonGenerator.writeFieldName("ScheduleExpression").writeValue(rule.getScheduleExpression());
      }
      if (rule.getRoleArn() != null) {
        jsonGenerator.writeFieldName("RoleArn").writeValue(rule.getRoleArn());
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }