Class FeatureConstructorParamsRegistry

java.lang.Object
ovh.mythmc.gestalt.features.FeatureConstructorParamsRegistry

public final class FeatureConstructorParamsRegistry extends Object
Stores custom constructor parameters for Feature-annotated classes that cannot be instantiated with a no-arg constructor.

When a feature requires constructor arguments, the corresponding FeatureConstructorParams should be registered here before the feature class is registered with Gestalt. The parameters are keyed by fully qualified class name.

  • Constructor Details

    • FeatureConstructorParamsRegistry

      public FeatureConstructorParamsRegistry()
  • Method Details

    • register

      public void register(@NotNull @NotNull String className, @Nullable @Nullable FeatureConstructorParams params)
      Associates the given constructor parameters with the specified class name.
      Parameters:
      className - the fully qualified name of the feature class
      params - the constructor parameters to store, or null to clear them
    • register

      public void register(@NotNull @NotNull Class<?> clazz, @Nullable @Nullable FeatureConstructorParams params)
      Associates the given constructor parameters with the specified class.
      Parameters:
      clazz - the feature class
      params - the constructor parameters to store, or null to clear them
    • unregister

      public void unregister(@NotNull @NotNull String className)
      Removes the constructor parameters associated with the specified class name.
      Parameters:
      className - the fully qualified name of the feature class
    • unregister

      public void unregister(@NotNull @NotNull Class<?> clazz)
      Removes the constructor parameters associated with the specified class.
      Parameters:
      clazz - the feature class
    • getParameters

      public FeatureConstructorParams getParameters(@NotNull @NotNull String className)
      Returns the constructor parameters registered for the specified class name, or null if none have been registered.
      Parameters:
      className - the fully qualified name of the feature class
      Returns:
      the registered constructor parameters, or null
    • getParameters

      public FeatureConstructorParams getParameters(@NotNull @NotNull Class<?> clazz)
      Returns the constructor parameters registered for the specified class, or null if none have been registered.
      Parameters:
      clazz - the feature class
      Returns:
      the registered constructor parameters, or null