T
- the type of the values in the id manager.public class FileBackedIdManager<T>
extends java.lang.Object
The provided implementation is immutable and, therefore, instances can be freely shared.
Modifier and Type | Class and Description |
---|---|
static class |
FileBackedIdManager.Builder<T>
A builder to create
FileBackedIdManager instances by adding
values that it associates with unique ids. |
Modifier and Type | Field and Description |
---|---|
static long |
NULL_ID
A null id to refer to values not contained by this manager.
|
Constructor and Description |
---|
FileBackedIdManager(java.io.File file)
Creates an id manager backed by the given file.
|
Modifier and Type | Method and Description |
---|---|
long |
getId(T value)
Returns the id associated with the given value, or
NULL_ID if
this id manager doesn't contain that value. |
T |
getValue(long id)
Returns the value associated with the given id, or
null if this
id manager doesn't contain that id. |
public static final long NULL_ID
public FileBackedIdManager(java.io.File file)
file
- the file that backs the id manager to create.public long getId(T value)
NULL_ID
if
this id manager doesn't contain that value.value
- the value whose associated id is to be returned.NULL_ID
if this id manager doesn't contain that value.public T getValue(long id)
null
if this
id manager doesn't contain that id.id
- the id whose associated value is to be returned.null
if this id manager doesn't contain that id.