public interface Holder<T>
Modifier and Type | Method and Description |
---|---|
boolean |
hasId()
Returns true if this holder has an id.
|
int |
id()
Returns the id of this holder, or -1 if this holder is direct.
|
boolean |
isDirect()
Returns true if this holder is backed by a direct value.
|
static <T> Holder<T> |
of(int id)
Returns an indirect id holder.
|
static <T> Holder<T> |
of(T value)
Returns a direct value holder.
|
T |
value()
Returns the value of this holder.
|
static <T> Holder<T> of(int id)
T
- the type of the valueid
- the idjava.lang.IllegalArgumentException
- if the id is negativestatic <T> Holder<T> of(T value)
T
- the type of the valuevalue
- the valueboolean isDirect()
hasId()
boolean hasId()
isDirect()
T value()
java.lang.IllegalArgumentException
- if this holder is not directisDirect()
int id()
hasId()