use of org.qi4j.runtime.value.ValueInstance in project qi4j-sdk by Qi4j.
the class ModuleInstance method newValueBuilderWithPrototype.
@Override
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<T>(modelModule, this, prototype);
}
Aggregations