io.virtdata.api.config.MutableConfigModel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of virtdata-lib-realer Show documentation
Show all versions of virtdata-lib-realer Show documentation
With inspiration from other libraries
package io.virtdata.api.config;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class MutableConfigModel implements ConfigModel {
private final List elements = new ArrayList<>();
public MutableConfigModel() {}
public MutableConfigModel add(String name, Class> clazz) {
add(new ConfigModel.Element(name, clazz));
return this;
}
private void add(ConfigModel.Element element) {
this.elements.add(element);
}
public ConfigModel asReadOnly() {
return this;
}
@Override
public List getElements() {
return Collections.unmodifiableList(elements);
}
}