Module inet.ipaddr
Package inet.ipaddr

Class AddressNetwork.HostIdentifierStringGenerator<T extends HostIdentifierString>

java.lang.Object
inet.ipaddr.AddressNetwork.HostIdentifierStringGenerator<T>
Type Parameters:
T - the type to be cached, typically either IPAddressString or HostName
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
IPAddressNetwork.HostNameGenerator, IPAddressNetwork.IPAddressStringGenerator
Enclosing class:
AddressNetwork<S extends AddressSegment>

public abstract static class AddressNetwork.HostIdentifierStringGenerator<T extends HostIdentifierString> extends Object implements Serializable
Generates and caches HostIdentifierString instances. Choose a map of your choice to implement a cache of address string identifiers.

You choose the map of your choice to be the backing map for the cache. For example, for thread-safe access to the cache, ConcurrentHashMap is a good choice. For maps of bounded size, LinkedHashMap provides the removeEldestEntry method to override to implement LRU or other eviction mechanisms.

Author:
sfoley
See Also:
  • Constructor Details

    • HostIdentifierStringGenerator

      public HostIdentifierStringGenerator()
    • HostIdentifierStringGenerator

      public HostIdentifierStringGenerator(Map<String,T> backingMap)
  • Method Details

    • getBackingMap

      public Map<String,T> getBackingMap()
    • contains

      public boolean contains(T value)
      Returns whether the given instance is in the cache.
      Parameters:
      value -
      Returns:
      whether the given instance of T is in the cache
    • get

      public T get(String key)
      Gets the object for the given key. If the object does not exist yet then it is created and added to the cache.
      Parameters:
      key -
      Returns:
      the object for the given key
    • get

      public abstract T get(byte[] bytes)
    • get

      public abstract T get(Address.AddressValueProvider addressProvider)