
de.tsl2.nano.modelkit.Configured Maven / Gradle / Ivy
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