Example #1
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof Trail == false) return false;
    Trail other = (Trail) obj;

    if (other.getName() == null ^ this.getName() == null) return false;
    if (other.getName() != null && other.getName().equals(this.getName()) == false) return false;
    if (other.getS3BucketName() == null ^ this.getS3BucketName() == null) return false;
    if (other.getS3BucketName() != null
        && other.getS3BucketName().equals(this.getS3BucketName()) == false) return false;
    if (other.getS3KeyPrefix() == null ^ this.getS3KeyPrefix() == null) return false;
    if (other.getS3KeyPrefix() != null
        && other.getS3KeyPrefix().equals(this.getS3KeyPrefix()) == false) return false;
    if (other.getSnsTopicName() == null ^ this.getSnsTopicName() == null) return false;
    if (other.getSnsTopicName() != null
        && other.getSnsTopicName().equals(this.getSnsTopicName()) == false) return false;
    if (other.isIncludeGlobalServiceEvents() == null ^ this.isIncludeGlobalServiceEvents() == null)
      return false;
    if (other.isIncludeGlobalServiceEvents() != null
        && other.isIncludeGlobalServiceEvents().equals(this.isIncludeGlobalServiceEvents())
            == false) return false;
    if (other.getCloudWatchLogsLogGroupArn() == null ^ this.getCloudWatchLogsLogGroupArn() == null)
      return false;
    if (other.getCloudWatchLogsLogGroupArn() != null
        && other.getCloudWatchLogsLogGroupArn().equals(this.getCloudWatchLogsLogGroupArn())
            == false) return false;
    if (other.getCloudWatchLogsRoleArn() == null ^ this.getCloudWatchLogsRoleArn() == null)
      return false;
    if (other.getCloudWatchLogsRoleArn() != null
        && other.getCloudWatchLogsRoleArn().equals(this.getCloudWatchLogsRoleArn()) == false)
      return false;
    return true;
  }
  public Trail unmarshall(JsonUnmarshallerContext context) throws Exception {
    Trail trail = new Trail();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.getCurrentToken();
    if (token == null) token = context.nextToken();
    if (token == VALUE_NULL) return null;

    while (true) {
      if (token == null) break;

      if (token == FIELD_NAME || token == START_OBJECT) {
        if (context.testExpression("Name", targetDepth)) {
          context.nextToken();
          trail.setName(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("S3BucketName", targetDepth)) {
          context.nextToken();
          trail.setS3BucketName(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("S3KeyPrefix", targetDepth)) {
          context.nextToken();
          trail.setS3KeyPrefix(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("SnsTopicName", targetDepth)) {
          context.nextToken();
          trail.setSnsTopicName(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("IncludeGlobalServiceEvents", targetDepth)) {
          context.nextToken();
          trail.setIncludeGlobalServiceEvents(
              BooleanJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("IsMultiRegionTrail", targetDepth)) {
          context.nextToken();
          trail.setIsMultiRegionTrail(BooleanJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("HomeRegion", targetDepth)) {
          context.nextToken();
          trail.setHomeRegion(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("TrailARN", targetDepth)) {
          context.nextToken();
          trail.setTrailARN(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("LogFileValidationEnabled", targetDepth)) {
          context.nextToken();
          trail.setLogFileValidationEnabled(
              BooleanJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("CloudWatchLogsLogGroupArn", targetDepth)) {
          context.nextToken();
          trail.setCloudWatchLogsLogGroupArn(
              StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("CloudWatchLogsRoleArn", targetDepth)) {
          context.nextToken();
          trail.setCloudWatchLogsRoleArn(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("KmsKeyId", targetDepth)) {
          context.nextToken();
          trail.setKmsKeyId(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
      } else if (token == END_ARRAY || token == END_OBJECT) {
        if (context.getLastParsedParentElement() == null
            || context.getLastParsedParentElement().equals(currentParentElement)) {
          if (context.getCurrentDepth() <= originalDepth) break;
        }
      }
      token = context.nextToken();
    }

    return trail;
  }