Class LazyReference<T>

java.lang.Object
de.marcely.bedwars.tools.LazyReference<T>
Type Parameters:
T - The type of the reference

public class LazyReference<T> extends Object
Represents a lazy reference that will only be initialized when it's being accessed.
  • Constructor Details

    • LazyReference

      public LazyReference(Supplier<T> factory)
      Creates a new lazy reference.
      Parameters:
      factory - The factory that will be called when the reference is being accessed
  • Method Details

    • get

      public T get()
      Gets the reference.
      Returns:
      The reference
      Throws:
      IllegalStateException - If the factory returns null