2 * ============LICENSE_START=======================================================
3 * org.onap.dcaegen2.collectors.ves
4 * ================================================================================
5 * Copyright (C) 2018 Nokia. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.onap.dcae.common.publishing;
22 import io.vavr.collection.List;
23 import io.vavr.control.Option;
25 import java.util.Objects;
28 * @author Pawel Szalapski (pawel.szalapski@nokia.com)
30 public final class PublisherConfig {
32 private final List<String> destinations;
33 private final String topic;
34 private String userName;
35 private String password;
37 PublisherConfig(List<String> destinations, String topic) {
38 this.destinations = destinations;
42 PublisherConfig(List<String> destinations, String topic, String userName, String password) {
43 this.destinations = destinations;
45 this.userName = userName;
46 this.password = password;
49 List<String> destinations() {
57 Option<String> userName() {
58 return Option.of(userName);
61 Option<String> password() {
62 return Option.of(password);
66 return userName().isDefined() && password().isDefined();
71 public boolean equals(Object o) {
75 if (o == null || getClass() != o.getClass()) {
78 PublisherConfig that = (PublisherConfig) o;
79 return Objects.equals(destinations, that.destinations) &&
80 Objects.equals(topic, that.topic) &&
81 Objects.equals(userName, that.userName) &&
82 Objects.equals(password, that.password);
86 public int hashCode() {
87 return Objects.hash(destinations, topic, userName, password);
91 public String toString() {
92 return "PublisherConfig{" +
93 "destinations=" + destinations +
94 ", topic='" + topic + '\'' +
95 ", userName='" + userName + '\'' +
96 ", password='" + password + '\'' +