Class KlumFactory.Keyed<T>

java.lang.Object
com.blackbuild.klum.ast.runtime.KlumFactory<T>
com.blackbuild.klum.ast.runtime.KlumFactory.Keyed<T>
Type Parameters:
T - The type of the model.
Enclosing class:
KlumFactory<T>

public abstract static class KlumFactory.Keyed<T> extends KlumFactory<T>
Factory for keyed models.
  • Constructor Details

    • Keyed

      protected Keyed(Class<T> type)
  • Method Details

    • AsBuilder

      Description copied from class: KlumFactory
      Returns the active-session factory used to create owned child Builders.
      Overrides:
      AsBuilder in class KlumFactory<T>
    • One

      public T One(String key)
      Creates a new instance of the model by only setting the key, but not applying any configuration (apart from 'postCreate' and 'postApply' methods).
      Parameters:
      key - The key to use for the model.
      Returns:
      The instantiated object.
    • With

      public T With(Map<String,?> configMap, String key, groovy.lang.Closure<?> configuration)
      Creates a new instance of the model with the given key and applying the given configuration map and closure.
      Parameters:
      configMap - The configuration map to apply to the model.
      key - The key to use for the model.
      configuration - The configuration closure to apply to the model.
      Returns:
      The instantiated object.
    • With

      @Deprecated(forRemoval=true) public T With(String key)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use One(String) instead.
      Convenience methods to allow simply replacing 'X.create' with 'X.Create.With' in scripts, without checking for arguments. This means that empty create calls like 'X.create("bla")' will correctly work afterward.
      Parameters:
      key - The key to use for the model
      Returns:
      The instantiated object.
    • With

      public T With(String key, groovy.lang.Closure<?> configuration)
      Creates a new instance of the model with the given key and applying the given configuration closure.
      Parameters:
      key - The key to use for the model.
      configuration - The configuration closure to apply to the model.
      Returns:
      The instantiated object.
    • With

      public T With(Map<String,?> configMap, String key)
      Creates a new instance of the model with the given key and applying the given configuration map.
      Parameters:
      configMap - The configuration map to apply to the model.
      key - The key to use for the model.
      Returns:
      The instantiated object.
    • From

      public T From(String key, String configuration)
      Creates a new instance of the model with the given key and then applying the given text as configuration.
      Parameters:
      key - The key of the model to create.
      configuration - the configuration text to apply to the model.
      Returns:
      The instantiated object.
    • From

      public T From(String key, String configuration, ClassLoader loader)
      Creates a new instance of the model with the given key and then applying the given text as configuration.
      Parameters:
      key - The key of the model to create.
      configuration - the configuration text to apply to the model.
      loader - The classloader used to compile the configuration text.
      Returns:
      The instantiated object.