use of org.qi4j.runtime.composite.TransientBuilderInstance in project qi4j-sdk by Qi4j.
the class ModuleInstance method newTransientBuilder.
// Implementation of TransientBuilderFactory
@Override
public <T> TransientBuilder<T> newTransientBuilder(Class<T> mixinType) throws NoSuchTransientException {
NullArgumentException.validateNotNull("mixinType", mixinType);
ModelModule<TransientModel> modelModule = typeLookup.lookupTransientModel(mixinType);
if (modelModule == null) {
throw new NoSuchTransientException(mixinType.getName(), name());
}
Map<AccessibleObject, Property<?>> properties = new HashMap<>();
for (PropertyModel propertyModel : modelModule.model().state().properties()) {
Property<?> property = new PropertyInstance<>(propertyModel.getBuilderInfo(), propertyModel.initialValue(modelModule.module()));
properties.put(propertyModel.accessor(), property);
}
TransientStateInstance state = new TransientStateInstance(properties);
return new TransientBuilderInstance<>(modelModule, state, UsesInstance.EMPTY_USES);
}
Aggregations