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

de.tsl2.nano.modelkit.impl.Def 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!
/*
 * File: $HeadURL$
 * Id  : $Id$
 * 
 * created by: Tom
 * created on: 31.03.2017
 * 
 * Copyright: (c) Thomas Schneider 2017, all rights reserved
 */
package de.tsl2.nano.modelkit.impl;

import java.util.Objects;

import lombok.Setter;

/**
 * base definitions (values, lists, etc.) hold by the configuration and provided to fact implementations.
 */
public class Def extends AIdentified {

    static {
        ModelKitLoader.registereElement(Def.class);
    }

    @Setter
    T value;

    Def() {
    }

    public Def(String name, T value) {
        super(name);
        this.value = value;
    }

    @Override
    public void validate() {
        Objects.requireNonNull(value, () -> config.name + ": definition is null (not registered?): " + toString());
    }

    public T getValue() {
        visited();
        return value;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy