Interface NCValueLoader

  • All Superinterfaces:

    public interface NCValueLoader
    extends NCLifecycle
    Dynamic value loader that can be used by model elements to dynamically load or create their values. Note that the primary use case for this interface is the dynamic value loading for the models defines in JSON/YAML presentation. However, it's not technically limited to that use case only, and this interface can be set programmatically when model elements are created programmatically too.

    When using JSON/YAML model presentation element values can be defined statically. However, in some cases, it is required to load these values from external sources like database or REST services while keeping the rest of the model declaration static (i.e. in JSON/YAML). To accomplish this you can define valueLoader property and provide a fully qualified class name that implements this interface. During the model instantiation an instance of that class will be created once per each model and class of loader and method load(NCElement) will be called to load element's values. Note that you can use both statically defined values (i.e. values property) and dynamically loaded values together and they will be merged:

         "elements": [
                 "id": "my:id",
                 "description": "My description.",
                 "values": [
                          "name": "name1",
                          "synonyms": ["syn1", "syn2"]
                 "valueLoader": "my.package.MyLoader"
    • Method Detail

      • load

        Set<NCValue> load​(NCElement owner)
        Loads values for given model element.
        owner - Model element to which this value loader belongs to.
        Set of values, potentially empty but never null.