Class AutoLoaded<T>

java.lang.Object
dev.jaxydog.lodestone.api.AutoLoaded<T>
Type Parameters:
T - The type of the value stored within this class.
All Implemented Interfaces:
Loaded

public class AutoLoaded<T> extends Object implements Loaded
A generic class that wraps a value of type T, providing a simple interface for applying arbitrary load methods to generic values. This is typically used alongside an AutoLoader class.

The inner value can be retrieved using the getValue() method.

Since:
1.8.0
  • Field Details

  • Constructor Details

    • AutoLoaded

      public AutoLoaded(net.minecraft.util.Identifier loaderId, T value) throws NullPointerException
      Creates a new AutoLoaded value.
      Parameters:
      loaderId - The loader Identifier.
      value - The inner value.
      Throws:
      NullPointerException - If the given value is null.
      Since:
      1.8.0
  • Method Details

    • getValue

      public final T getValue()
      Returns this wrapper's inner value.
      Returns:
      The inner value.
      Since:
      1.8.0
    • on

      public final AutoLoaded<T> on(Class<? extends Loaded> type, AutoLoaded.LoadMethod<T> method) throws NullPointerException
      Adds a method that will be run within the specified Loaded interface.
      Parameters:
      type - The Loaded interface.
      method - The method to run.
      Returns:
      This value.
      Throws:
      NullPointerException - If either the Loaded interface or the given method are null.
      Since:
      1.8.0
    • getLoaderId

      public final net.minecraft.util.Identifier getLoaderId()
      Description copied from interface: Loaded
      Returns this value's associated identifier, typically used during the automatic loading process.
      Specified by:
      getLoaderId in interface Loaded
      Returns:
      This value's associated identifier.