Class HostNameDataNullObject

java.lang.Object
de.calamanari.pk.nullobject.HostNameDataNullObject
All Implemented Interfaces:
HostNameData, java.io.Serializable, java.lang.Iterable<java.lang.String>

public final class HostNameDataNullObject
extends java.lang.Object
implements HostNameData
Host Name Data Null Object - NULL OBJECT implementation for HostNameList
Author:
Karl Eilebrecht
See Also:
Serialized Form
  • Field Summary

    Fields
    Modifier and Type Field Description
    static HostNameDataNullObject INSTANCE
    The only instance of this NULL OBJECT
  • Method Summary

    Modifier and Type Method Description
    boolean addHostName​(java.lang.String name)
    Adds the name to the list
    boolean contains​(java.lang.String name)
    Returns whether this list contains the name
    boolean containsAll​(java.util.Collection<? extends java.lang.String> names)
    Returns whether the list contains all of the given names
    <T extends HostNameData>
    T
    copy()
    Creates a copy of this object, so that the internal state of the copy will be independent.
    This is not a deep clone as the values will not be copied but referenced.
    java.lang.String get​(int index)
    Returns the name at the given position
    int getNumberOfEntries()
    Returns the number of entries in host name data
    java.lang.String getPurpose()
    returns the purpose (whatever this might be :-) )
    int indexOf​(java.lang.String name)
    Returns the position of the given entry
    java.util.Iterator<java.lang.String> iterator()  
    java.lang.Object readResolve()
    Do not create new instance during de-serialization
    java.lang.String[] toArray()
    Returns an array with all the names from the list

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Field Details

  • Method Details

    • iterator

      public java.util.Iterator<java.lang.String> iterator()
      Specified by:
      iterator in interface java.lang.Iterable<java.lang.String>
    • getNumberOfEntries

      public int getNumberOfEntries()
      Description copied from interface: HostNameData
      Returns the number of entries in host name data
      Specified by:
      getNumberOfEntries in interface HostNameData
      Returns:
      number of entries
    • getPurpose

      public java.lang.String getPurpose()
      Description copied from interface: HostNameData
      returns the purpose (whatever this might be :-) )
      Specified by:
      getPurpose in interface HostNameData
      Returns:
      purpose of list
    • contains

      public boolean contains​(java.lang.String name)
      Description copied from interface: HostNameData
      Returns whether this list contains the name
      Specified by:
      contains in interface HostNameData
      Parameters:
      name - the host name to look for
      Returns:
      true if found
    • indexOf

      public int indexOf​(java.lang.String name)
      Description copied from interface: HostNameData
      Returns the position of the given entry
      Specified by:
      indexOf in interface HostNameData
      Parameters:
      name - the host name to look for
      Returns:
      true if found otherwise -1
    • containsAll

      public boolean containsAll​(java.util.Collection<? extends java.lang.String> names)
      Description copied from interface: HostNameData
      Returns whether the list contains all of the given names
      Specified by:
      containsAll in interface HostNameData
      Parameters:
      names - collection of names to look for
      Returns:
      true if all names of the given list where found in this list
    • toArray

      public java.lang.String[] toArray()
      Description copied from interface: HostNameData
      Returns an array with all the names from the list
      Specified by:
      toArray in interface HostNameData
      Returns:
      array of names
    • get

      public java.lang.String get​(int index)
      Description copied from interface: HostNameData
      Returns the name at the given position
      Specified by:
      get in interface HostNameData
      Parameters:
      index - position
      Returns:
      name at the given index or null if not found
    • addHostName

      public boolean addHostName​(java.lang.String name)
      Description copied from interface: HostNameData
      Adds the name to the list
      Specified by:
      addHostName in interface HostNameData
      Parameters:
      name - host name
      Returns:
      true if the name was added, false otherwise
    • copy

      public <T extends HostNameData> T copy()
      Description copied from interface: HostNameData
      Creates a copy of this object, so that the internal state of the copy will be independent.
      This is not a deep clone as the values will not be copied but referenced.
      Specified by:
      copy in interface HostNameData
      Type Parameters:
      T - expected concrete class implementing HostNameData
      Returns:
      copy of this object
    • readResolve

      public java.lang.Object readResolve()
      Do not create new instance during de-serialization
      Returns:
      INSTANCE