T
- the type to be cached, typically either IPAddressString or HostNamepublic abstract static class IPAddressNetwork.HostIDStringAddressGenerator<T extends HostIdentifierString>
extends java.lang.Object
implements java.io.Serializable
You can also use this class without a cache to serve as a factory of addresses or host names, which can be particularly useful if you are using your own network, or if you are using your own validation options.
For long-running programs or servers that handle many addresses, the benefits of using a cache are that
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.
Constructor and Description |
---|
HostIDStringAddressGenerator() |
HostIDStringAddressGenerator(IPAddressStringParameters options) |
HostIDStringAddressGenerator(java.util.Map<java.lang.String,T> backingMap) |
HostIDStringAddressGenerator(java.util.Map<java.lang.String,T> backingMap,
IPAddressStringParameters options) |
Modifier and Type | Method and Description |
---|---|
T |
get(Address.AddressProvider addressProvider) |
T |
get(Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider,
java.lang.Integer prefixLength,
java.lang.CharSequence zone) |
T |
get(byte[] bytes) |
T |
get(IPAddress.IPVersion version,
Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider,
java.lang.Integer prefixLength) |
java.util.Map<java.lang.String,T> |
getBackingMap() |
static Address.SegmentValueProvider |
getValueProvider(byte[] bytes) |
static Address.SegmentValueProvider |
getValueProvider(byte[] bytes,
int segmentByteCount) |
public HostIDStringAddressGenerator()
public HostIDStringAddressGenerator(IPAddressStringParameters options)
public HostIDStringAddressGenerator(java.util.Map<java.lang.String,T> backingMap)
public HostIDStringAddressGenerator(java.util.Map<java.lang.String,T> backingMap, IPAddressStringParameters options)
public java.util.Map<java.lang.String,T> getBackingMap()
public static Address.SegmentValueProvider getValueProvider(byte[] bytes)
public static Address.SegmentValueProvider getValueProvider(byte[] bytes, int segmentByteCount)
public T get(byte[] bytes)
public T get(Address.AddressProvider addressProvider)
public T get(IPAddress.IPVersion version, Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, java.lang.Integer prefixLength)
public T get(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, java.lang.Integer prefixLength, java.lang.CharSequence zone)