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

com.example.ValueWithList Maven / Gradle / Ivy

There is a newer version: 0.8.0
Show newest version
package com.example;

import java.lang.Boolean;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import java.util.function.Supplier;

/**
 * Value type ValueWithList.
 *
 * Auto-generated from specification.
 */
public final class ValueWithList {
    private final List names;

    /**
     * Constructor.
     */
    private ValueWithList(List names) {
        this.names = names;
    }

    /**
     * Factory method for builder.
     * @return a new builder for ValueWithList
     */
    public static Builder builder() {
        return new Builder();
    }

    /**
     * Getter for the property names.
     * @return the value of names
     */
    public List getNames() {
        return names;
    }

    @Override
    public String toString() {
        return "ValueWithList[names=" + names + "]";
    }

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

    @Override
    public boolean equals(Object other) {
        if (other == this) {
            return true;
        }
        else if (other == null || !this.getClass().equals(other.getClass())) {
            return false;
        }
        final ValueWithList that = (ValueWithList) other;
        return this.names.equals(that.names);
    }

    /**
     * The builder for ValueWithList.
     */
    public static final class Builder {
        private List names = new java.util.ArrayList();

        private Builder() {
        }

        /**
         * Method to configure property names on the builder.
         * @return this builder
         */
        public Builder names(List names) {
            this.names = names;
            return this;
        }

        /**
         * Applies the function to the builder if and only if the condition is {@code true}.
         * @param condition the condition to evaluate
         * @param function the function to apply
         * @return this builder
         */
        public Builder ifThen(Supplier condition, Function function) {
            if (condition.get()) {
                return function.apply(this);
            }
            else {
                return this;
            }
        }

        /**
         * Build an instance of ValueWithList.
         * @return a new instance of ValueWithList
         */
        public ValueWithList build() {
            Objects.requireNonNull(names);
            return new ValueWithList(names);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy