Class InstantiationUtil

java.lang.Object
com.blamejared.crafttweaker.api.util.InstantiationUtil

public class InstantiationUtil extends Object
  • Constructor Details

    • InstantiationUtil

      public InstantiationUtil()
  • Method Details

    • getOrCreateInstance

      public static <T> T getOrCreateInstance(Class<T> cls)
      Tries to get the instance two ways (in this order): 1) Via a public static field (recommended being final as well) 2) Via a public no-arg constructor

      Does absolutely no caching, so don't call this when not necessary

      Parameters:
      cls - The class to instantiate
      Returns:
      The instance, or 'null'