Package com.blackbuild.klum.ast.runtime
Class KlumFactory<T>
java.lang.Object
com.blackbuild.klum.ast.runtime.KlumFactory<T>
- Type Parameters:
T- The type of the DSL model object.
- Direct Known Subclasses:
KlumFactory.Keyed,KlumFactory.Unkeyed
Factory to create DSL model objects.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classKlumFactory.BuilderFactory<T,B extends KlumBuilder<T>> Active-session Builder-producing operations shared by keyed and unkeyed factories.static interfaceKlumFactory.BuilderFactoryProvider<T,B extends KlumBuilder<T>> Public factory capability used by generated polymorphic relationship methods.static classFactory for keyed models.static final classKlumFactory.KeyedBuilderFactory<T,B extends KlumBuilder<T>> Builder-producing operations for keyed model types.static classFactory for unkeyed models.static final classKlumFactory.UnkeyedBuilderFactory<T,B extends KlumBuilder<T>> Builder-producing operations for unkeyed model types. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the active-session factory used to create owned child Builders.Creates a new instance of the model type by instantiating the class and applying the text content of the given file to it.From(File configurationFile, ClassLoader loader) Creates a new instance of the model type by instantiating the class and applying the text content of the given file to it.Creates a new instance of the model type by instantiating the class and applying the text content of the given file to it.Creates a new instance of the model type by instantiating the class and applying the text content of the given file to it.Creates a new instance of the model type by running the given script class.Creates a new instance of the model type by instantiating the class and applying the text content of the given url to it.From(URL configurationUrl, ClassLoader loader) Creates a new instance of the model type by instantiating the class and applying the text content of the given url to it.Creates a new instance of the model type by instantiating the class and applying the text content of the given url to it.Creates a new instance of the model type by instantiating the class and applying the text content of the given url to it.Creates a new instance of this owner's model type by reading the script from a well-defined properties file placed in '/META-INF/klum-model/"schema-classname".properties'.FromClasspath(ClassLoader loader) Creates a new instance of this owner's model type by reading the script from a well-defined properties file placed in '/META-INF/klum-model/"schema-classname".properties'.Creates a new instance of the model type by applying the given configuration map.Returns the DSL Object type selected by this factory.
-
Field Details
-
type
-
-
Constructor Details
-
KlumFactory
-
-
Method Details
-
getModelType
Returns the DSL Object type selected by this factory. -
AsBuilder
Returns the active-session factory used to create owned child Builders. -
FromClasspath
Creates a new instance of this owner's model type by reading the script from a well-defined properties file placed in '/META-INF/klum-model/"schema-classname".properties'. The properties file must contain a property name "model-class" which contains the name of the compiled script to run, which must return an instance of the model class.- Returns:
- The created model object.
- See Also:
-
FromClasspath
Creates a new instance of this owner's model type by reading the script from a well-defined properties file placed in '/META-INF/klum-model/"schema-classname".properties'. The properties file must contain a property name "model-class" which contains the name of the compiled script to run, which must return an instance of the model class.- Parameters:
loader- The classloader to use to load the properties file.- Returns:
- The created model object.
- See Also:
-
From
Creates a new instance of the model type by running the given script class. The script must either return an instance of the model (i.e. contain something like 'MyClass.Create.With {...}') or must be aDelegatingScriptwhose contents are the same as create/apply closure for this model class.Note that in case of a Keyed object in combination with a DelegatingScript, the simple name of the script class is used as key.
- Parameters:
configurationScript- The script class to run.- Returns:
- The instantiated object.
-
From
Creates a new instance of the model type by instantiating the class and applying the text content of the given url to it. In case of a keyed model, the last part of the URL is used as the key.- Parameters:
configurationUrl- The URL where to take the configuration text from.- Returns:
- The instantiated object.
- See Also:
-
From
Creates a new instance of the model type by instantiating the class and applying the text content of the given url to it. In case of a keyed model, the last part of the URL is used as the key.- Parameters:
configurationUrl- The URL where to take the configuration text from.keyProvider- A function that derives the key from the URL.- Returns:
- The instantiated object.
- See Also:
-
From
Creates a new instance of the model type by instantiating the class and applying the text content of the given url to it. In case of a keyed model, the last part of the URL is used as the key.- Parameters:
configurationUrl- The URL where to take the configuration text from.loader- The classloader to use for compiling the configuration text.- Returns:
- The instantiated object.
-
From
Creates a new instance of the model type by instantiating the class and applying the text content of the given url to it. In case of a keyed model, the key is derived from the URL using the provided keyProvider.- Parameters:
configurationUrl- The URL where to take the configuration text from.keyProvider- A function that derives the key from the URL.loader- The classloader to use for compiling the configuration text.- Returns:
- The instantiated object.
-
From
Creates a new instance of the model type by instantiating the class and applying the text content of the given file to it. In case of a keyed model, the filename is used as the key.- Parameters:
configurationFile- The file where to take the configuration text from.- Returns:
- The instantiated object.
- See Also:
-
From
Creates a new instance of the model type by instantiating the class and applying the text content of the given file to it. In case of a keyed model, provided keyProvider is used to derive the key from the file object.- Parameters:
configurationFile- The file where to take the configuration text from.keyProvider- A function that derives the key from the file.loader- The classloader to use for compiling the configuration text.- Returns:
- The instantiated object.
-
From
Creates a new instance of the model type by instantiating the class and applying the text content of the given file to it. In case of a keyed model, the filename is used as the key.- Parameters:
configurationFile- The file where to take the configuration text from.- Returns:
- The instantiated object.
- See Also:
-
From
Creates a new instance of the model type by instantiating the class and applying the text content of the given file to it. In case of a keyed model, the filename is used as the key.- Parameters:
configurationFile- The file where to take the configuration text from.loader- The classloader to use for compiling the configuration text.- Returns:
- The instantiated object.
-
FromMap
Creates a new instance of the model type by applying the given configuration map. By default, this takes the key from a map entry that is named as the key field, other values of the map are set to their respective fields.- Parameters:
configMap- a map containing the values to set on the model.- Returns:
- The instantiated object.
-