All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.smithy.build.plugins.BuildInfo Maven / Gradle / Ivy

Go to download

This module is a library used to validate Smithy models, create filtered projections of a model, and generate build artifacts.

There is a newer version: 1.54.0
Show newest version
/*
 * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file 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 software.amazon.smithy.build.plugins;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import software.amazon.smithy.build.SmithyBuild;
import software.amazon.smithy.build.model.ProjectionConfig;
import software.amazon.smithy.model.node.Node;
import software.amazon.smithy.model.shapes.ShapeId;
import software.amazon.smithy.model.validation.ValidationEvent;

/**
 * POJO to represents a smithy-build-info.json file.
 */
public final class BuildInfo {
    private String version = SmithyBuild.VERSION;
    private String projectionName = "source";
    private ProjectionConfig projection;
    private List validationEvents = Collections.emptyList();
    private List traitNames = Collections.emptyList();
    private List traitDefNames = Collections.emptyList();
    private List serviceShapeIds = Collections.emptyList();
    private List operationShapeIds = Collections.emptyList();
    private List resourceShapeIds = Collections.emptyList();
    private Map metadata = Collections.emptyMap();

    /**
     * @return Gets the version of the build-info file format.
     */
    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    /**
     * @return Gets the name of the projection used in this build.
     */
    public String getProjectionName() {
        return projectionName;
    }

    public void setProjectionName(String projectionName) {
        this.projectionName = projectionName;
    }

    /**
     * @return Gets the projection configuration.
     */
    public ProjectionConfig getProjection() {
        return projection;
    }

    public void setProjection(ProjectionConfig projection) {
        this.projection = projection;
    }

    /**
     * @return Gets the validation events encountered by the projection.
     */
    public List getValidationEvents() {
        return validationEvents;
    }

    public void setValidationEvents(List validationEvents) {
        this.validationEvents = validationEvents;
    }

    /**
     * @return Gets the shape ID of every trait used in the projected model.
     */
    public List getTraitNames() {
        return traitNames;
    }

    public void setTraitNames(List traitNames) {
        this.traitNames = traitNames;
    }

    /**
     * @return Gets the shape ID of every trait shape defined in the projection.
     */
    public List getTraitDefNames() {
        return traitDefNames;
    }

    public void setTraitDefNames(List traitDefNames) {
        this.traitDefNames = traitDefNames;
    }

    /**
     * @return Gets the shape ID of every service in the projection.
     */
    public List getServiceShapeIds() {
        return serviceShapeIds;
    }

    public void setServiceShapeIds(List serviceShapeIds) {
        this.serviceShapeIds = serviceShapeIds;
    }

    /**
     * @return Gets the shape ID of every operation in the projection.
     */
    public List getOperationShapeIds() {
        return operationShapeIds;
    }

    public void setOperationShapeIds(List operationShapeIds) {
        this.operationShapeIds = operationShapeIds;
    }

    /**
     * @return Gets the shape ID of every resource in the projection.
     */
    public List getResourceShapeIds() {
        return resourceShapeIds;
    }

    public void setResourceShapeIds(List resourceShapeIds) {
        this.resourceShapeIds = resourceShapeIds;
    }

    /**
     * @return Gets the model metadata in the projection.
     */
    public Map getMetadata() {
        return metadata;
    }

    public void setMetadata(Map metadata) {
        this.metadata = metadata;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        } else if (!(o instanceof BuildInfo)) {
            return false;
        }

        BuildInfo buildInfo = (BuildInfo) o;
        return Objects.equals(getVersion(), buildInfo.getVersion())
               && Objects.equals(getProjectionName(), buildInfo.getProjectionName())
               && Objects.equals(getProjection(), buildInfo.getProjection())
               && Objects.equals(getValidationEvents(), buildInfo.getValidationEvents())
               && Objects.equals(getTraitNames(), buildInfo.getTraitNames())
               && Objects.equals(getTraitDefNames(), buildInfo.getTraitDefNames())
               && Objects.equals(getServiceShapeIds(), buildInfo.getServiceShapeIds())
               && Objects.equals(getOperationShapeIds(), buildInfo.getOperationShapeIds())
               && Objects.equals(getResourceShapeIds(), buildInfo.getResourceShapeIds())
               && Objects.equals(getMetadata(), buildInfo.getMetadata());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getVersion(), getProjectionName(), getProjection(), getValidationEvents(),
                            getTraitNames(), getTraitDefNames(), getServiceShapeIds(), getOperationShapeIds(),
                            getResourceShapeIds(), getMetadata());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy