Package org.spongepowered.api.registry
Interface Registry<T>
- Type Parameters:
- T- The type
A store of 
registry entries with a well defined type.- 
Method SummaryModifier and TypeMethodDescriptiondefault <V extends T>
 Optional<RegistryEntry<V>>findEntry(RegistryKey<T> key) findEntry(ResourceKey), provided for convenience when usingRegistryKey.<V extends T>
 Optional<RegistryEntry<V>>findEntry(ResourceKey key) findValue(RegistryKey<T> key) findValue(ResourceKey), provided for convenience when usingRegistryKey.findValue(ResourceKey key) findValueKey(T value) Gets thekeyfor a particular value, if found.booleanReturns if this registry supports adding additional values.<V extends T>
 Optional<RegistryEntry<V>>register(ResourceKey key, V value) Registers a new value to this registry.stream()Gets aStreamof all registry values within.taggedValues(Tag<T> tag) Returns the registered types associated with given tag.tags()Gets the tags associated with this registry.type()Gets thekeyidentifying this registry.default <V extends T>
 Vvalue(RegistryKey<T> key) value(ResourceKey), provided for convenience when usingRegistryKey.<V extends T>
 Vvalue(ResourceKey key) Gets thekeyfor a particular value.
- 
Method Details- 
typeRegistryType<T> type()Gets thekeyidentifying this registry.- Returns:
- The key
 
- 
valueKeyGets thekeyfor a particular value.Great care needs to be made in calling this method with any uncertainty as to if the key will exist. Should the value lack a key, a IllegalStateExceptionwill be thrown. Therefore, it is advised to callfindValueKey(Object)instead.- Parameters:
- value- The value
- Returns:
- The key
 
- 
findValueKeyGets thekeyfor a particular value, if found.The value must be registered within to be retrieved by key. - Parameters:
- value- The value
- Returns:
- The key or Optional.empty()
 
- 
findEntryGets theentryfor a particularkey, if found.The value must be registered within to be retrieved by key. - Parameters:
- key- The key
- Returns:
- The entry or Optional.empty()
 
- 
findEntryfindEntry(ResourceKey), provided for convenience when usingRegistryKey.- Parameters:
- key- The key
- Returns:
- The entry or Optional.empty()
 
- 
findValue- Parameters:
- key- The key
- Returns:
- The value or Optional.empty()
 
- 
findValuefindValue(ResourceKey), provided for convenience when usingRegistryKey.- Parameters:
- key- The key
- Returns:
- The value or Optional.empty()
 
- 
valueGets thevaluefor a particularkey.Great care needs to be made in calling this method with any uncertainty as to if the key will exist. Should this key lack a value, a ValueNotFoundExceptionwill be thrown. Therefore, it is advised to callfindValue(ResourceKey)orfindValue(RegistryKey)instead.- Parameters:
- key- The key
- Returns:
- The value
 
- 
taggedValuesReturns the registered types associated with given tag.- Parameters:
- tag- The tag
- Returns:
- The registered types associated with given tag
 
- 
tagsGets the tags associated with this registry.- Returns:
- The tags associated with this registry
 
- 
valuevalue(ResourceKey), provided for convenience when usingRegistryKey.- Parameters:
- key- The key
- Returns:
- The value
 
- 
streamEntriesStream<RegistryEntry<T>> streamEntries()- Returns:
- The stream
 
- 
streamGets aStreamof all registry values within.- Returns:
- The stream
 
- 
isDynamicboolean isDynamic()Returns if this registry supports adding additional values.- Returns:
- True if the registry can add additional values
 
- 
registerRegisters a new value to this registry.If this registry is not dynamicor the provided key is already registered,Optional.empty()is returned instead.- Parameters:
- key- The key
- value- The value
- Returns:
- The newly added entry, Optional.empty()otherwise
 
 
-