com.rosetta.metatest.model.util.Observable14DeepPathUtil Maven / Gradle / Ivy
package com.rosetta.metatest.model.util;
import com.rosetta.metatest.model.Asset14;
import com.rosetta.metatest.model.Instrument14;
import com.rosetta.metatest.model.Observable14;
import com.rosetta.metatest.model.metafields.FieldWithMetaAsset14;
import com.rosetta.model.lib.mapper.MapperS;
import java.math.BigDecimal;
import javax.inject.Inject;
import static com.rosetta.model.lib.expression.ExpressionOperators.*;
public class Observable14DeepPathUtil {
private final Asset14DeepPathUtil asset14DeepPathUtil;
@Inject
public Observable14DeepPathUtil(Asset14DeepPathUtil asset14DeepPathUtil) {
this.asset14DeepPathUtil = asset14DeepPathUtil;
}
public BigDecimal chooseAmount(Observable14 observable14) {
final MapperS asset14 = MapperS.of(observable14).map("getAsset14", _observable14 -> _observable14.getAsset14()).map("getValue", _f->_f.getValue());
if (exists(asset14).getOrDefault(false)) {
return asset14.map("chooseAmount", _asset14 -> asset14DeepPathUtil.chooseAmount(_asset14)).get();
}
return null;
}
public Asset14 chooseAsset14(Observable14 observable14) {
final MapperS asset14 = MapperS.of(observable14).map("getAsset14", _observable14 -> _observable14.getAsset14()).map("getValue", _f->_f.getValue());
if (exists(asset14).getOrDefault(false)) {
return asset14.get();
}
return null;
}
public Instrument14 chooseInstrument14(Observable14 observable14) {
final MapperS asset14 = MapperS.of(observable14).map("getAsset14", _observable14 -> _observable14.getAsset14()).map("getValue", _f->_f.getValue());
if (exists(asset14).getOrDefault(false)) {
return asset14.map("chooseInstrument14", _asset14 -> asset14DeepPathUtil.chooseInstrument14(_asset14)).get();
}
return null;
}
}