firstStage static method
Danger<PropertyTableStruct, ChainException>
firstStage(
- Chain chain,
- TemplateSettingStruct templateSettingStruct
fragment property が参照されてしまわれないように, permanently property と list property のみ値を入力する.
Implementation
static Danger<PropertyTableStruct, ChainException> firstStage(Chain chain, TemplateSettingStruct templateSettingStruct) {
final log = Log(classLocation: PropertyTableStruct, functionLocation: 'firstStage');
// default の値は設定せず 入力が無い場合は exception として user に報告する.
final List<PermanentlyPropertyStruct> permanentlyList = [];
for (final i in templateSettingStruct.permanentlyPropertyNameList) {
final getResult = chain.getOptionAsSingleString(i);
log.add(getResult);
if (getResult is! Success<String, ChainExceptionIJK>) return Failure(getResult.asException, log);
final property = PermanentlyPropertyStruct(i, getResult.wrapped);
permanentlyList.add(property);
}
final List<ListPropertyStruct> listList = [];
for (final i in templateSettingStruct.listPropertyNameList) {
final getResult = chain.getOptionAsMultipleString(i);
log.add(getResult);
if (getResult is! Success<List<String>, ChainExceptionI>) return Failure(getResult.asException, log);
final property = ListPropertyStruct(i, getResult.wrapped);
listList.add(property);
}
final permanentlyPropertyRoster = PropertyStructList(permanentlyList);
final listPropertyRoster = PropertyStructList(listList);
final result = PropertyTableStruct(
permanentlyPropertyRoster,
PropertyStructList.empty(),
listPropertyRoster,
PropertyStructList.empty(),
);
return Success(result, log);
}