Class VirtualClass

java.lang.Object
org.geysermc.conduit.VirtualClass

public class VirtualClass extends Object
A class found by ConduitContext.scanClasses(ClassFilter), by name.

Nothing is loaded until resolve() or isAssignableFrom(String) is called. Those load the class through the context, without initializing it.

  • Constructor Details

    • VirtualClass

      public VirtualClass(@NotNull @NotNull Class<?> clazz, @NotNull @NotNull ConduitContext context)
      Refers to a class by its loaded type.
      Parameters:
      clazz - the class
      context - the context to load it from
    • VirtualClass

      public VirtualClass(@NotNull @NotNull String className, @NotNull @NotNull ConduitContext context)
      Refers to a class by name, without loading it.
      Parameters:
      className - the binary name of the class
      context - the context to load it from
  • Method Details

    • className

      @NotNull public @NotNull String className()
      The binary name of the class, such as com.example.Color.
      Returns:
      the binary name of the class
    • resolve

      @NotNull public @NotNull Class<?> resolve() throws ClassNotFoundException
      Loads the class from the context.
      Returns:
      the class
      Throws:
      ClassNotFoundException - if it can't be loaded
    • isAssignableFrom

      public boolean isAssignableFrom(@NotNull @NotNull String interfaceName)
      Loads the class and checks whether it is a subtype of another.
      Parameters:
      interfaceName - the binary name of the supertype
      Returns:
      whether the class extends or implements it, false if either can't be loaded
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object