use of org.qi4j.runtime.value.ValueBuilderWithPrototype in project qi4j-sdk by Qi4j.
the class ModuleInstance method newValueBuilderWithPrototype.
@Override
@SuppressWarnings("unchecked")
public <T> ValueBuilder<T> newValueBuilderWithPrototype(T prototype) {
NullArgumentException.validateNotNull("prototype", prototype);
ValueInstance valueInstance = ValueInstance.valueInstanceOf((ValueComposite) prototype);
Class<Composite> valueType = (Class<Composite>) first(valueInstance.types());
ModelModule<ValueModel> modelModule = typeLookup.lookupValueModel(valueType);
if (modelModule == null) {
throw new NoSuchValueException(valueType.getName(), name());
}
return new ValueBuilderWithPrototype<>(modelModule, this, prototype);
}
Aggregations