com.rosetta.metatest.model.util.Observable14DeepPathUtil Maven / Gradle / Ivy
The newest version!
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());
if (exists(asset14).getOrDefault(false)) {
return asset14.map("Type coercion", fieldWithMetaAsset14 -> fieldWithMetaAsset14 == null ? null : fieldWithMetaAsset14.getValue()).map("chooseAmount", _asset14 -> asset14DeepPathUtil.chooseAmount(_asset14)).get();
}
return null;
}
public FieldWithMetaAsset14 chooseAsset14(Observable14 observable14) {
final MapperS asset14 = MapperS.of(observable14).map("getAsset14", _observable14 -> _observable14.getAsset14());
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());
if (exists(asset14).getOrDefault(false)) {
return asset14.map("Type coercion", fieldWithMetaAsset14 -> fieldWithMetaAsset14 == null ? null : fieldWithMetaAsset14.getValue()).map("chooseInstrument14", _asset14 -> asset14DeepPathUtil.chooseInstrument14(_asset14)).get();
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy