Class SimpleClassResolver

java.lang.Object
ch.njol.yggdrasil.SimpleClassResolver
All Implemented Interfaces:
ClassResolver

@NotThreadSafe public class SimpleClassResolver extends Object implements ClassResolver
  • Constructor Details

    • SimpleClassResolver

      public SimpleClassResolver()
  • Method Details

    • registerClass

      public void registerClass(Class<?> type, String id)
    • getClass

      @Nullable public @Nullable Class<?> getClass(String id)
      Description copied from interface: ClassResolver
      Resolves a class by its ID.
      Specified by:
      getClass in interface ClassResolver
      Parameters:
      id - The ID used when storing objects
      Returns:
      The Class object that represents data with the given ID, or null if the ID does not belong to the implementor
    • getID

      @Nullable public @Nullable String getID(Class<?> type)
      Description copied from interface: ClassResolver
      Gets an ID for a Class. The ID is used to identify the type of saved object.

      Specified by:
      getID in interface ClassResolver
      Parameters:
      type - The class to get the ID of
      Returns:
      The ID of the given class, or null if this is not a class of the implementor