public interface Keyable
Types implementing this interface define a set of valid keys. Typically, these keys are serialized to or extracted from some serialized object.
MapCodec
Modifier and Type | Method and Description |
---|---|
static Keyable |
forStrings(by-name Stream<String> keys)
Returns a
Keyable that defines the keys supplied by the argument. |
<T> Stream<T> |
keys(DynamicOps<T> ops)
Returns the set of keys this object defines or accepts, serialized to the provided form.
|
<T> Stream<T> keys(DynamicOps<T> ops)
T
- The type of the serialized form.ops
- The DynamicOps
instance defining the serialized form.static Keyable forStrings(by-name Stream<String> keys)
Keyable
that defines the keys supplied by the argument.
The supplier must return a fresh stream on each invocation. As well, care should be taken that the
source backing the returned stream is not modified or otherwise invalidated, because the returned
Keyable
does not store a local copy of the keys. The caller is responsible for making
a defensive copy of the backing source, if one is required.
keys
- A supplier of key streams. A fresh stream should be returned on each invocation.Keyable
for the given keys.