Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.naming/share/classes/javax/naming/ldap/spi/LdapDnsProviderResult.java
41161 views
1
/*
2
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package javax.naming.ldap.spi;
27
28
import java.util.List;
29
30
/**
31
* The result of a DNS lookup for an LDAP URL.
32
*
33
* <p> This class is used by an {@link LdapDnsProvider} to return the result
34
* of a DNS lookup for a given LDAP URL. The result consists of a domain name
35
* and its associated LDAP server endpoints.
36
*
37
* <p> A {@code null} {@code domainName} is equivalent to and represented
38
* by an empty string.
39
*
40
* @since 12
41
*/
42
public final class LdapDnsProviderResult {
43
44
private final String domainName;
45
private final List<String> endpoints;
46
47
/**
48
* Construct an LdapDnsProviderResult consisting of a resolved domain name
49
* and the LDAP server endpoints that serve the domain.
50
*
51
* @param domainName the resolved domain name; can be null.
52
* @param endpoints the possibly empty list of resolved LDAP server
53
* endpoints
54
*
55
* @throws NullPointerException if {@code endpoints} contains {@code null}
56
* elements.
57
* @throws ClassCastException if {@code endpoints} contains non-
58
* {@code String} elements.
59
*/
60
public LdapDnsProviderResult(String domainName, List<String> endpoints) {
61
this.domainName = (domainName == null) ? "" : domainName;
62
this.endpoints = List.copyOf(endpoints);
63
}
64
65
/**
66
* Returns the domain name resolved from the LDAP URL. This method returns
67
* the empty string if the {@code LdapDnsProviderResult} is created with a
68
* null domain name.
69
*
70
* @return the resolved domain name
71
*/
72
public String getDomainName() {
73
return domainName;
74
}
75
76
/**
77
* Returns the possibly empty list of individual server endpoints resolved
78
* from the LDAP URL.
79
*
80
* @return a possibly empty unmodifiable {@link List} containing the
81
* resolved LDAP server endpoints
82
*/
83
public List<String> getEndpoints() {
84
return endpoints;
85
}
86
}
87
88