All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.tsl2.nano.modelkit.Configured Maven / Gradle / Ivy

Go to download

TSL2 Framework to provide and use a structure of elements referenced by unique names - to declare a kit of logic in a json/yaml/xml text file

The newest version!
package de.tsl2.nano.modelkit;

import java.util.List;

import de.tsl2.nano.modelkit.impl.ModelKit;

/**
 * provides a mechanism to access the base configuration.
 */
public interface Configured {
    /** each artifact should be assigned to a configuration */
    void setConfiguration(ModelKit config);

    /** get all artifacts of given type from configuration */
     List get(Class type);

    /** get an name-identifable of given type from configuration */
     T get(String name, Class type);

    /** check all named artifacts to be found inside configuration */
    void validate();

    /** provides a check mechanism for count of calls to each configured element */
    void visited(Object... explanation);

    /** only for test purposes */
    long getVisitorCount();

    /** only for test purposes */
    String getVisitorInfo();

    /** helper to check for existence in configuration */
    default  void checkExistence(Class type, List names) {
        names.stream().forEach(c -> checkExistence(c, type));
    }

    /** helper to check for existence in configuration */
    default  String checkExistence(String name, Class type) {
        if (name != null) {
            get(name, type);
        }
        return name;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy