
dev.lukebemish.codecextras.companion.MapDelegatingOps Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codecextras Show documentation
Show all versions of codecextras Show documentation
Various extensions and utilities for Mojang's DFU library
The newest version!
package dev.lukebemish.codecextras.companion;
import com.mojang.serialization.DynamicOps;
import java.util.Map;
import java.util.Optional;
class MapDelegatingOps extends DelegatingOps {
Map>> companions;
MapDelegatingOps(DynamicOps delegate, Map>> companions) {
super(delegate);
this.companions = companions;
}
@SuppressWarnings("unchecked")
@Override
public > Optional getCompanion(O token) {
var companion = companions.get(token);
if (companion != null) {
return (Optional) companion;
}
return super.getCompanion(token);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy