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:
    java.io.Serializable
    Direct Known Subclasses:
    IPAddressNetwork.HostNameGenerator, IPAddressNetwork.IPAddressStringGenerator
    Enclosing class:
    AddressNetwork<S extends AddressSegment>


    public abstract static class AddressNetwork.HostIdentifierStringGenerator<T extends HostIdentifierString>
    extends java.lang.Object
    implements java.io.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.

    See Also:
    Serialized Form
    • Constructor Detail

      • HostIdentifierStringGenerator

        public HostIdentifierStringGenerator()
      • HostIdentifierStringGenerator

        public HostIdentifierStringGenerator(java.util.Map<java.lang.String,T> backingMap)
    • Method Detail

      • getBackingMap

        public java.util.Map<java.lang.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(java.lang.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)