static SimpleLiveValue dm_fieldLiveValueWithConversions(S fieldName, Class type, IF1 convertFromField, IF1 convertToField) {
ret dm_fieldLiveValueWithConversions(dm_current_mandatory(), fieldName, type, convertFromField, convertToField);
}
static SimpleLiveValue dm_fieldLiveValueWithConversions(S fieldName, Class type, F1 convertFromField, F1 convertToField) {
ret dm_fieldLiveValueWithConversions(dm_current_mandatory(), fieldName, type, convertFromField, convertToField);
}
static SimpleLiveValue dm_fieldLiveValueWithConversions(DynModule module, S fieldName, Class type, IF1 convertFromField, IF1 convertToField) {
lock module.lock;
temp module.enter(); // for dm_watchField
SimpleLiveValue value = new(type, convertFromField.get((B) get(module, fieldName)));
dm_watchField(fieldName, r {
value.set(convertFromField.get((B) get(module, fieldName)));
});
value.onChange(r {
module.setField(fieldName, convertToField.get(value!));
});
ret value;
}
static SimpleLiveValue dm_fieldLiveValueWithConversions(DynModule module, S fieldName, Class type, F1 convertFromField, F1 convertToField) {
lock module.lock;
temp module.enter(); // for dm_watchField
SimpleLiveValue value = new(type, convertFromField.get((B) get(module, fieldName)));
dm_watchField(fieldName, r {
value.set(convertFromField.get((B) get(module, fieldName)));
});
value.onChange(r {
module.setField(fieldName, convertToField.get(value!));
});
ret value;
}