T
- the type to be cached, typically either IPAddressString or HostNamepublic abstract static class IPAddressNetwork.HostIDStringAddressGenerator<T extends HostIdentifierString> extends Object implements 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(Map<String,T> backingMap) |
HostIDStringAddressGenerator(Map<String,T> backingMap,
IPAddressStringParameters options) |
Modifier and Type | Method and Description |
---|---|
T |
get(Address.AddressValueProvider addressProvider) |
T |
get(Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider,
Integer prefixLength,
CharSequence zone) |
T |
get(byte[] bytes) |
T |
get(IPAddress.IPAddressValueProvider addressProvider) |
T |
get(IPAddress.IPVersion version,
Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider,
Integer prefixLength) |
Map<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(Map<String,T> backingMap, IPAddressStringParameters options)
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.AddressValueProvider addressProvider)
public T get(IPAddress.IPAddressValueProvider addressProvider)
public T get(IPAddress.IPVersion version, Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, Integer prefixLength)
public T get(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, Integer prefixLength, CharSequence zone)