use of org.qi4j.runtime.value.ValueBuilderWithState in project qi4j-sdk by Qi4j.
the class ModuleInstance method newValueBuilderWithState.
@Override
public <T> ValueBuilder<T> newValueBuilderWithState(Class<T> mixinType, Function<PropertyDescriptor, Object> propertyFunction, Function<AssociationDescriptor, EntityReference> associationFunction, Function<AssociationDescriptor, Iterable<EntityReference>> manyAssociationFunction, Function<AssociationDescriptor, Map<String, EntityReference>> namedAssociationFunction) {
NullArgumentException.validateNotNull("propertyFunction", propertyFunction);
NullArgumentException.validateNotNull("associationFunction", associationFunction);
NullArgumentException.validateNotNull("manyAssociationFunction", manyAssociationFunction);
NullArgumentException.validateNotNull("namedAssociationFunction", namedAssociationFunction);
ModelModule<ValueModel> compositeModelModule = typeLookup.lookupValueModel(mixinType);
if (compositeModelModule == null) {
throw new NoSuchValueException(mixinType.getName(), name());
}
StateResolver stateResolver = new FunctionStateResolver(propertyFunction, associationFunction, manyAssociationFunction, namedAssociationFunction);
return new ValueBuilderWithState<>(compositeModelModule, this, stateResolver);
}
Aggregations