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>

public class HostPortSet extends LinkedHashSet<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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    String
    Returns a space-delimited list of host names contained in this set.
    String
    Returns a space-delimited list of port numbers contained in this set.
    boolean
    Returns true if any HostPortPair in the specified set is contained in this set.
    newInstance(String hostProperty, String portProperty)
    Create a new HostPortSet object from a list of host and ports.
    String
     

    Methods inherited from class java.util.LinkedHashSet

    addFirst, addLast, getFirst, getLast, newLinkedHashSet, removeFirst, removeLast, reversed, spliterator

    Methods inherited from class java.util.HashSet

    add, clear, clone, contains, isEmpty, iterator, newHashSet, remove, size, toArray, toArray

    Methods inherited from class java.util.AbstractSet

    equals, hashCode, removeAll

    Methods inherited from class java.util.AbstractCollection

    addAll, containsAll, retainAll

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.Collection

    parallelStream, removeIf, stream, toArray

    Methods inherited from interface java.lang.Iterable

    forEach

    Methods 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

      public static HostPortSet newInstance(String hostProperty, String portProperty)
      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

      public boolean intersects(HostPortSet set)
      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:
      toString in class AbstractCollection<HostPortPair>