Package com.cryptomorin.xseries.base
Class XRegistry<XForm extends XBase<XForm,BukkitForm>,BukkitForm>
java.lang.Object
com.cryptomorin.xseries.base.XRegistry<XForm,BukkitForm>
- Type Parameters:
XForm- The type used within this library.BukkitForm- The corresponding Bukkit type of theXRegistry.
- All Implemented Interfaces:
Iterable<XForm>
@Internal
public final class XRegistry<XForm extends XBase<XForm,BukkitForm>,BukkitForm>
extends Object
implements Iterable<XForm>
A registry similar to Bukkit's
Registry. It holds values as a form of XBase and
allows cross-version name mappings and also direct bukkit-to-xform mappings as well.- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionXRegistry(Class<BukkitForm> bukkitFormClass, Class<XForm> xFormClass, Function<Integer, XForm[]> createArray) XRegistry(Class<BukkitForm> bukkitFormClass, Class<XForm> xFormClass, Supplier<Object> registrySupplier, BiFunction<BukkitForm, String[], XForm> creator, Function<Integer, XForm[]> createArray) -
Method Summary
Modifier and TypeMethodDescription@NotNull Map<BukkitForm, XForm> voidSaves memory.@NotNull FieldgetBackingField(XForm xForm) protected BukkitFormGets the class of the bukkit form.static @NotNull StringgetBukkitName(@NotNull Object bukkitForm) getByBukkitForm(BukkitForm bukkit) getName()Gets the name of the registry, which is usually the bukkit form's simple class name.getOrRegisterMetadata(XForm form, Field formField, boolean peekOnly) @Unmodifiable @NotNull Collection<XForm> Gets the class of the xform.iterator()static @Nullable XRegistry<?, ?> rawRegistryOf(Class<?> clazz) Gets the registry associated to aXBaseclass.protected static <XForm extends XBase<XForm,BukkitForm>, BukkitForm>
voidregisterModule(XRegistry<XForm, BukkitForm> registry, Class<? extends XForm> clazz) voidregisterName(String name, XForm xForm) registryOf(Class<? extends XForm> clazz) Gets the registry associated to aXBaseclass.std(Function<BukkitForm, XForm> xForm, String[] names) stdEnum(XForm xForm, String[] names, BukkitForm bukkit) toString()XForm[]values()Deprecated.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
XRegistry
@Internal public XRegistry(Class<BukkitForm> bukkitFormClass, Class<XForm> xFormClass, Supplier<Object> registrySupplier, BiFunction<BukkitForm, String[], XForm> creator, Function<Integer, XForm[]> createArray) -
XRegistry
-
-
Method Details
-
rawRegistryOf
Gets the registry associated to aXBaseclass. Usually this method is used for serialization purposes since the generic information of the class isn't always known.- See Also:
-
registryOf
@Nullable @Experimental public static <XForm extends XBase<XForm,BukkitForm>, @Nullable XRegistry<XForm,BukkitForm> BukkitForm> registryOf(Class<? extends XForm> clazz) Gets the registry associated to aXBaseclass.- See Also:
-
registerModule
-
nameMapping
-
bukkitMapping
-
getBukkitFormClass
Gets the class of the bukkit form. -
getXFormClass
Gets the class of the xform. -
getName
Gets the name of the registry, which is usually the bukkit form's simple class name. -
registerName
-
getBukkit
-
discardMetadata
@Internal public void discardMetadata()Saves memory. -
getValues
- See Also:
-
values
Deprecated.Use ofvalues()should be discouraged by staticXModuleimplementations, insteadgetValues()should be used. -
iterator
-
getByBukkitForm
-
getByName
-
getBukkitName
-
std
-
stdEnum
-
stdEnum
-
getBackingField
-
getOrRegisterMetadata
@Internal public XModuleMetadata getOrRegisterMetadata(XForm form, Field formField, boolean peekOnly) -
std
-
std
-
std
-
toString
-
values()should be discouraged by staticXModuleimplementations, insteadgetValues()should be used.