Package com.sas.services.connection
Class HostPortSet
java.lang.Object
java.util.AbstractCollection<HostPortPair>
java.util.AbstractSet<HostPortPair>
java.util.HashSet<HostPortPair>
java.util.LinkedHashSet<HostPortPair>
com.sas.services.connection.HostPortSet
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<HostPortPair>,Collection<HostPortPair>,SequencedCollection<HostPortPair>,SequencedSet<HostPortPair>,Set<HostPortPair>
Wraps multiple
HostPortPair instances into one object. Used when multiple hostname
and port values need to be included in a single property string.- Since:
- 9.4
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionStringgetHosts()Returns a space-delimited list of host names contained in this set.StringgetPorts()Returns a space-delimited list of port numbers contained in this set.booleanintersects(HostPortSet set) Returns true if any HostPortPair in the specified set is contained in this set.static HostPortSetnewInstance(String hostProperty, String portProperty) Create a new HostPortSet object from a list of host and ports.StringtoString()Methods inherited from class java.util.LinkedHashSet
addFirst, addLast, getFirst, getLast, newLinkedHashSet, removeFirst, removeLast, reversed, spliteratorMethods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, newHashSet, remove, size, toArray, toArrayMethods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAllMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.lang.Iterable
forEachMethods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
-
Constructor Details
-
HostPortSet
public HostPortSet()
-
-
Method Details
-
newInstance
Create a new HostPortSet object from a list of host and ports.- Parameters:
hostProperty- space-delimited list of host names. May be abbreviated to a single instance of the host name if all names in the list are identical.portProperty- space-delimited list of port numbers. May be abbreviated to a single port number if all ports in the list are identical.- Returns:
- new HostPortSet object
-
getHosts
public String getHosts()Returns a space-delimited list of host names contained in this set. The list will be abbreviated if all host names in this set are identical. Returns null if the set is empty.- Returns:
- a space-delimited list of host names
-
getPorts
public String getPorts()Returns a space-delimited list of port numbers contained in this set. The list will be abbreviated if all port numbers in this set are identical. Returns null if the set is empty.- Returns:
- a space-delimited list of port numbers
-
intersects
Returns true if any HostPortPair in the specified set is contained in this set.- Parameters:
set- set to be compared- Returns:
- true if any HostPortPair in the specified set is contained in this set
-
toString
public String toString()- Overrides:
toStringin classAbstractCollection<HostPortPair>
-