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

io.linguarobot.aws.cdk.maven.ParameterValue Maven / Gradle / Ivy

Go to download

The AWS CDK Maven plugin produces and deploys CloudFormation templates based on the cloud infrastructure defined by means of CDK. The goal of the project is to improve the experience of Java developers while working with CDK by eliminating the need for installing Node.js and interacting with the CDK application by means of CDK Toolkit.

There is a newer version: 0.0.8
Show newest version
package io.linguarobot.aws.cdk.maven;

import javax.annotation.Nullable;
import java.util.Objects;

/**
 * Represents CloudFormation stack parameter value.
 */
public class ParameterValue {

    private static final ParameterValue UNCHANGED = new ParameterValue(null);

    private final String value;

    private ParameterValue(@Nullable String value) {
        this.value = value;
    }

    @Nullable
    public String get() {
        return value;
    }

    public boolean isUpdated() {
        return value != null;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ParameterValue that = (ParameterValue) o;
        return Objects.equals(value, that.value);
    }

    @Override
    public int hashCode() {
        return Objects.hash(value);
    }

    @Override
    public String toString() {
        if (value == null) {
            return "unchanged()";
        }

        return "value(\"" + value + "\")";
    }

    /**
     * Creates a parameter value that will preserve its previous value after update.
     */
    public static ParameterValue unchanged() {
        return UNCHANGED;
    }

    /**
     * Creates a parameter value with the given {@code value}.
     */
    public static ParameterValue value(String value) {
        return new ParameterValue(Objects.requireNonNull(value, "The value cannot be null"));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy