Class | RGen::Instantiator::JsonInstantiator |
In: |
lib/rgen/instantiator/json_instantiator.rb
|
Parent: | Object |
JsonInstantiator is used to create RGen models from JSON.
Each JSON object needs to have an attribute "_class" which is used to find the metamodel class to instantiate. The value of "_class" should be the the relative qualified class name within the root package as a string.
If the option "short_class_names" is set to true, unqualified class names can be used. In this case, metamodel classes are searched in the metamodel root package first. If this search is not successful, all subpackages will be searched for the class name.
Model elements will be created in evironment env, classes are looked for in metamodel package module mm, options include:
short_class_names: if true subpackages will be searched for unqualifed class names (default: true) ignore_keys: an array of json object key names which are to be ignored (default: none)
The options are also passed to the underlying QualifiedNameResolver.
Creates the elements described by the json string str. Returns an array of ReferenceResolver::UnresolvedReference describing the references which could not be resolved
Options:
:root_elements: if an array is provided, it will be filled with the root elements