Package org.spongepowered.api.registry
Interface DefaultedRegistryReference<T>
-
- Type Parameters:
T
- The type
- All Superinterfaces:
RegistryKey<T>
,RegistryReference<T>
,java.util.function.Supplier<T>
public interface DefaultedRegistryReference<T> extends RegistryReference<T>, java.util.function.Supplier<T>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.spongepowered.api.registry.RegistryReference
RegistryReference.Factory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.function.Supplier<RegistryHolder>
defaultHolder()
java.util.Optional<T>
find()
T
get()
Gets the value from the defaultholder
given when constructing this reference.-
Methods inherited from interface org.spongepowered.api.registry.RegistryKey
asDefaultedReference, asReference, location, registry
-
Methods inherited from interface org.spongepowered.api.registry.RegistryReference
find, get
-
-
-
-
Method Detail
-
get
T get()
Gets the value from the defaultholder
given when constructing this reference.Great care needs to be made in calling this method with any uncertainty as to if this reference will exist in the holder. Should this reference lack a value, a
ValueNotFoundException
will be thrown. Therefore, it is advised to callRegistryReference.find(RegistryHolder...)
instead.- Specified by:
get
in interfacejava.util.function.Supplier<T>
- Returns:
- The value
-
find
java.util.Optional<T> find()
-
defaultHolder
java.util.function.Supplier<RegistryHolder> defaultHolder()
-
-