StorageMetadata.java

72 lines | 1.804 kB Blame History Raw Download
/*
 * Copyright 2017 LinkedIn Corp.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 *
 */

package azkaban.spi;

import java.util.Objects;

import static java.util.Objects.*;


public class StorageMetadata {
  private final String projectId;
  private final String version;
  private final String extension;

  public StorageMetadata(String projectId, String version, String extension) {
    this.projectId = requireNonNull(projectId);
    this.version = requireNonNull(version);
    this.extension = requireNonNull(extension);
  }

  @Override
  public String toString() {
    return "StorageMetadata{" + "projectId='" + projectId + '\'' + ", version='" + version + '\'' + '}';
  }

  public String getProjectId() {
    return projectId;
  }

  public String getVersion() {
    return version;
  }

  public String getExtension() {
    return extension;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    StorageMetadata that = (StorageMetadata) o;
    return Objects.equals(projectId, that.projectId) &&
        Objects.equals(version, that.version) &&
        Objects.equals(extension, that.extension);
  }

  @Override
  public int hashCode() {
    return Objects.hash(projectId, version, extension);
  }
}