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

seatsio.events.ChannelCreationParams Maven / Gradle / Ivy

The newest version!
package seatsio.events;

import com.google.gson.JsonObject;
import seatsio.util.ValueObject;

import java.util.Set;

import static seatsio.json.JsonObjectBuilder.aJsonObject;

public class ChannelCreationParams extends ValueObject {

    private final String key;
    private final String name;
    private final String color;
    private final Integer index;
    private final Set objects;

    public ChannelCreationParams(String key, String name, String color, Integer index, Set objects) {
        this.key = key;
        this.name = name;
        this.color = color;
        this.index = index;
        this.objects = objects;
    }

    public JsonObject toJson() {
        return aJsonObject()
                .withProperty("key", key)
                .withProperty("name", name)
                .withProperty("color", color)
                .withPropertyIfNotNull("index", index)
                .withPropertyIfNotNull("objects", objects)
                .build();
    }

    public static class Builder {

        private String key;
        private String name;
        private String color;
        private Integer index;
        private Set objects;

        public Builder withKey(String channelKey) {
            this.key = channelKey;
            return this;
        }

        public Builder withName(String name) {
            this.name = name;
            return this;
        }

        public Builder withColor(String color) {
            this.color = color;
            return this;
        }

        public Builder withIndex(int index) {
            this.index = index;
            return this;
        }

        public Builder withObjects(Set objectLabels) {
            this.objects = objectLabels;
            return this;
        }

        public ChannelCreationParams build() {
            return new ChannelCreationParams(
                    this.key,
                    this.name,
                    this.color,
                    this.index,
                    this.objects
            );
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy