Path: blob/master/src/java.base/share/classes/javax/net/ssl/KeyStoreBuilderParameters.java
41159 views
/*1* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.net.ssl;2627import java.util.*;2829import java.security.KeyStore.*;3031/**32* A parameters object for X509KeyManagers that encapsulates a List33* of KeyStore.Builders.34*35* @see java.security.KeyStore.Builder36* @see X509KeyManager37*38* @author Andreas Sterbenz39* @since 1.540*/41public class KeyStoreBuilderParameters implements ManagerFactoryParameters {4243private final List<Builder> parameters;4445/**46* Construct new KeyStoreBuilderParameters from the specified47* {@linkplain java.security.KeyStore.Builder}.48*49* @param builder the Builder object50* @exception NullPointerException if builder is null51*/52public KeyStoreBuilderParameters(Builder builder) {53parameters = Collections.singletonList(Objects.requireNonNull(builder));54}5556/**57* Construct new KeyStoreBuilderParameters from a List58* of {@linkplain java.security.KeyStore.Builder}s. Note that the list59* is cloned to protect against subsequent modification.60*61* @param parameters the List of Builder objects62* @exception NullPointerException if parameters is null63* @exception IllegalArgumentException if parameters is an empty list64*/65public KeyStoreBuilderParameters(List<Builder> parameters) {66if (parameters.isEmpty()) {67throw new IllegalArgumentException();68}6970this.parameters = Collections.unmodifiableList(71new ArrayList<Builder>(parameters));72}7374/**75* Return the unmodifiable List of the76* {@linkplain java.security.KeyStore.Builder}s77* encapsulated by this object.78*79* @return the unmodifiable List of the80* {@linkplain java.security.KeyStore.Builder}s81* encapsulated by this object.82*/83public List<Builder> getParameters() {84return parameters;85}8687}888990