getFinalValue method

Danger<Object, PropertyTableException> getFinalValue(
  1. PropertyName propertyName
)

propertyName の最終的に解決された場合の primitive な値を取得する.

Implementation

Danger<Object, PropertyTableException> getFinalValue(PropertyName propertyName) {

    final log = Log(classLocation: runtimeType, functionLocation: 'getFinalValue');

    final getPropertyResult = getProperty(propertyName);
    log.add(getPropertyResult);
    if (getPropertyResult is! Success<Property, PropertyTableExceptionB>) return Failure(getPropertyResult.asException, log.monitor({
        'not exist proerty': propertyName.value,
        'exist property name list': propertyNameList.toPrimitive(),
    }));
    final property = getPropertyResult.wrapped;

    switch (property) {
    case PermanentlyProperty():

        return Success(property.value.value, log);

    case TemporaryProperty():

        final result = property.getCurrentValue();
        log.add(result);
        if (result is! Success<PropertyListValue, PropertyListValueExceptionA>) return Failure(result.asException, log.monitor({
            'property name': propertyName.value,
            'length': property.value.length,
            'laps': property.laps.value,
        }));

        return Success(result.wrapped.value, log);

    case ListProperty():

        return Success(property.value.toPrimitive(), log);

    case FragmentProperty():

        return Success(property.value.value, log);

    }

}