2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.sal.connect.netconf.listener;
10 import static java.util.Objects.requireNonNull;
12 import org.eclipse.jdt.annotation.NonNull;
15 * DTO with user capabilities to override or merge with device specific capabilities.
17 public record UserPreferences(
18 @NonNull NetconfSessionPreferences sessionPreferences,
19 boolean overrideModuleCapabilities,
20 boolean overrideNonModuleCapabilities) {
22 public UserPreferences {
23 requireNonNull(sessionPreferences);
25 if (overrideModuleCapabilities && sessionPreferences.moduleBasedCaps().isEmpty()) {
26 throw new IllegalStateException(
27 "Override module based capabilities flag set true but module based capabilities list is empty.");
29 if (overrideNonModuleCapabilities && sessionPreferences.nonModuleCaps().isEmpty()) {
30 throw new IllegalStateException(
31 "Override non-module based capabilities set true but non-module based capabilities list is empty.");